Add `AddQuery`
This commit is contained in:
parent
76898f89c3
commit
c4b9627422
|
@ -55,6 +55,17 @@ public class DbClient
|
||||||
RsndMain.Db.SetValue(setQuery);
|
RsndMain.Db.SetValue(setQuery);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case QueryType.AddToTable:
|
||||||
|
{
|
||||||
|
AddQuery addQuery = JsonConvert.DeserializeObject<AddQuery>(query);
|
||||||
|
foreach (var column in addQuery?.Columns)
|
||||||
|
{
|
||||||
|
Console.WriteLine(column.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case QueryType.CreateTable:
|
case QueryType.CreateTable:
|
||||||
{
|
{
|
||||||
CreateTableQuery createTableQuery = JsonConvert.DeserializeObject<CreateTableQuery>(query);
|
CreateTableQuery createTableQuery = JsonConvert.DeserializeObject<CreateTableQuery>(query);
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
using RSND.Core.DbInternals;
|
||||||
|
|
||||||
|
namespace RSND.Core.Querying.Queries;
|
||||||
|
|
||||||
|
public class AddQuery : Query
|
||||||
|
{
|
||||||
|
public string TableName { get; set; }
|
||||||
|
public Column[] Columns { get; set; }
|
||||||
|
}
|
|
@ -14,6 +14,7 @@ public static class QueryHelper
|
||||||
{
|
{
|
||||||
"GetValue" => QueryType.GetValue,
|
"GetValue" => QueryType.GetValue,
|
||||||
"SetValue" => QueryType.SetValue,
|
"SetValue" => QueryType.SetValue,
|
||||||
|
"AddToTable" => QueryType.AddToTable,
|
||||||
"CreateTable" => QueryType.CreateTable,
|
"CreateTable" => QueryType.CreateTable,
|
||||||
_ => null
|
_ => null
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,5 +4,6 @@ public enum QueryType
|
||||||
{
|
{
|
||||||
GetValue,
|
GetValue,
|
||||||
SetValue,
|
SetValue,
|
||||||
|
AddToTable,
|
||||||
CreateTable
|
CreateTable
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
using Fleck;
|
using Fleck;
|
||||||
using RSND.Core;
|
using RSND.Core;
|
||||||
|
using RSND.Core.DbInternals;
|
||||||
|
|
||||||
namespace RSND;
|
namespace RSND;
|
||||||
|
|
||||||
|
@ -12,6 +13,21 @@ public static class RsndMain
|
||||||
Db.SetupFiles();
|
Db.SetupFiles();
|
||||||
Db.Save();
|
Db.Save();
|
||||||
|
|
||||||
|
Db.CreateTable(new Table
|
||||||
|
{
|
||||||
|
Name = "fooTable",
|
||||||
|
Rows = new []
|
||||||
|
{
|
||||||
|
new Row
|
||||||
|
{
|
||||||
|
Columns = new []
|
||||||
|
{
|
||||||
|
new Column("test", "1")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
WebSocketServer server = new WebSocketServer("ws://0.0.0.0:7878");
|
WebSocketServer server = new WebSocketServer("ws://0.0.0.0:7878");
|
||||||
Console.WriteLine("Server started");
|
Console.WriteLine("Server started");
|
||||||
FleckLog.Level = LogLevel.Error;
|
FleckLog.Level = LogLevel.Error;
|
||||||
|
|
Loading…
Reference in New Issue