Add `AddQuery`
This commit is contained in:
parent
76898f89c3
commit
c4b9627422
|
@ -55,6 +55,17 @@ public class DbClient
|
|||
RsndMain.Db.SetValue(setQuery);
|
||||
break;
|
||||
}
|
||||
case QueryType.AddToTable:
|
||||
{
|
||||
AddQuery addQuery = JsonConvert.DeserializeObject<AddQuery>(query);
|
||||
foreach (var column in addQuery?.Columns)
|
||||
{
|
||||
Console.WriteLine(column.Value);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
case QueryType.CreateTable:
|
||||
{
|
||||
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,
|
||||
"SetValue" => QueryType.SetValue,
|
||||
"AddToTable" => QueryType.AddToTable,
|
||||
"CreateTable" => QueryType.CreateTable,
|
||||
_ => null
|
||||
};
|
||||
|
|
|
@ -4,5 +4,6 @@ public enum QueryType
|
|||
{
|
||||
GetValue,
|
||||
SetValue,
|
||||
AddToTable,
|
||||
CreateTable
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
using Fleck;
|
||||
using RSND.Core;
|
||||
using RSND.Core.DbInternals;
|
||||
|
||||
namespace RSND;
|
||||
|
||||
|
@ -12,6 +13,21 @@ public static class RsndMain
|
|||
Db.SetupFiles();
|
||||
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");
|
||||
Console.WriteLine("Server started");
|
||||
FleckLog.Level = LogLevel.Error;
|
||||
|
|
Loading…
Reference in New Issue