Open niamtokik opened 1 year ago
Some draft...
?[f1, f2, f3] <- [
[1,2,3]
[2, 3, 4]
]
:put test{f1, f2, f3}
-record(test, { f1 :: integer(), f2 :: integer(), f3 :: integer() }).
% create a new table using test record
cozo:create_table(Db, #test{}).
% create a list of data to insert
Data = [
#test{ f1 = 1, f2 = 2, f3 = 3 },
#test{ f1 = 2, f2 = 3, f3 = 4 }
].
% insert all data
cozo:put(Db, Data).
cozo_parse:from_erlang({ integer, 123 }).
%
cozo_parse:from_erlang({ float, 123.123 }).
%
cozo_parse:from_erlang({ number, 123 }).
%
{integer, 123}
{float, 123.123}
{number, 123}
{list, [{integer, 123}]}
{string, <<"test">>}
The current structure is simple, we generate a query from a string and receive the result as json. A more Erlangish way should be used.