This commit is contained in:
Christian Fraß 2023-08-10 10:36:31 +02:00
parent ab9f1a6d6d
commit 6cbe925d7c
8 changed files with 325 additions and 276 deletions

View file

@ -31,7 +31,9 @@
{ {
"name": "person", "name": "person",
"description": "collection of contacts", "description": "collection of contacts",
"key_field": null, "key_field": {
"name": "id"
},
"data_fields": [ "data_fields": [
{ {
"name": "prename", "name": "prename",

View file

@ -637,7 +637,7 @@ declare namespace lib_plankton.string {
to: string; to: string;
}>, options?: {}): string; }>, options?: {}): string;
/** /**
* @desc replaces occurences of "${name}" in a string by the corresponding values of an argument object * @desc replaces occurences of "{{name}}" in a string by the corresponding values of an argument object
* @author fenris * @author fenris
*/ */
function coin(str: string, args: { function coin(str: string, args: {
@ -1200,7 +1200,10 @@ declare namespace lib_plankton.prog {
class struct_statement_type_definition extends struct_statement { class struct_statement_type_definition extends struct_statement {
name: string; name: string;
type: struct_type; type: struct_type;
constructor(name: string, type: struct_type); export_: boolean;
constructor(name: string, type: struct_type, options?: {
export?: boolean;
});
} }
} }
declare namespace lib_plankton.prog { declare namespace lib_plankton.prog {
@ -1211,7 +1214,10 @@ declare namespace lib_plankton.prog {
name: string; name: string;
type: (null | struct_type); type: (null | struct_type);
value: (null | struct_expression); value: (null | struct_expression);
constructor(constant: boolean, name: string, type: (null | struct_type), value: (null | struct_expression)); export_: boolean;
constructor(constant: boolean, name: string, type: (null | struct_type), value: (null | struct_expression), options?: {
export?: boolean;
});
} }
} }
declare namespace lib_plankton.prog { declare namespace lib_plankton.prog {

View file

@ -1712,7 +1712,7 @@ var lib_plankton;
} }
string.replace = replace; string.replace = replace;
/** /**
* @desc replaces occurences of "${name}" in a string by the corresponding values of an argument object * @desc replaces occurences of "{{name}}" in a string by the corresponding values of an argument object
* @author fenris * @author fenris
*/ */
function coin(str, args, options = {}) { function coin(str, args, options = {}) {
@ -3981,10 +3981,16 @@ var lib_plankton;
*/ */
var struct_statement_type_definition = /** @class */ (function (_super) { var struct_statement_type_definition = /** @class */ (function (_super) {
__extends(struct_statement_type_definition, _super); __extends(struct_statement_type_definition, _super);
function struct_statement_type_definition(name, type) { function struct_statement_type_definition(name, type, options) {
var _this = _super.call(this) || this; if (options === void 0) { options = {}; }
var _this = this;
options = Object.assign({
"export": false,
}, options);
_this = _super.call(this) || this;
_this.name = name; _this.name = name;
_this.type = type; _this.type = type;
_this.export_ = options.export;
return _this; return _this;
} }
return struct_statement_type_definition; return struct_statement_type_definition;
@ -4019,12 +4025,18 @@ var lib_plankton;
*/ */
var struct_statement_declaration = /** @class */ (function (_super) { var struct_statement_declaration = /** @class */ (function (_super) {
__extends(struct_statement_declaration, _super); __extends(struct_statement_declaration, _super);
function struct_statement_declaration(constant, name, type, value) { function struct_statement_declaration(constant, name, type, value, options) {
var _this = _super.call(this) || this; if (options === void 0) { options = {}; }
var _this = this;
options = Object.assign({
"export": false,
}, options);
_this = _super.call(this) || this;
_this.constant = constant; _this.constant = constant;
_this.name = name; _this.name = name;
_this.type = type; _this.type = type;
_this.value = value; _this.value = value;
_this.export_ = options.export;
return _this; return _this;
} }
return struct_statement_declaration; return struct_statement_declaration;
@ -4628,9 +4640,12 @@ var lib_plankton;
} }
else if (statement instanceof prog.struct_statement_type_definition) { else if (statement instanceof prog.struct_statement_type_definition) {
var statement_type_definition = statement; var statement_type_definition = statement;
return lib_plankton.string.coin("{{indentation}}type {{name}} = {{type}};\n", { return lib_plankton.string.coin("{{indentation}}{{macro_export}}type {{name}} = {{type}};\n", {
"indentation": indentation(options.indent, options.level), "indentation": indentation(options.indent, options.level),
"name": statement_type_definition.name, "name": statement_type_definition.name,
"macro_export": ((!statement_type_definition.export_)
? ""
: "export "),
"type": render_type(statement_type_definition.type, { "type": render_type(statement_type_definition.type, {
"indent": false, "indent": false,
"level": (options.level + 0), "level": (options.level + 0),
@ -4639,12 +4654,15 @@ var lib_plankton;
} }
else if (statement instanceof prog.struct_statement_declaration) { else if (statement instanceof prog.struct_statement_declaration) {
var statement_declaration = statement; var statement_declaration = statement;
return lib_plankton.string.coin("{{indentation}}{{kind}} {{name}}{{macro_type}}{{macro_value}};\n", { return lib_plankton.string.coin("{{indentation}}{{macro_export}}{{kind}} {{name}}{{macro_type}}{{macro_value}};\n", {
"indentation": indentation(options.indent, options.level), "indentation": indentation(options.indent, options.level),
"kind": (statement_declaration.constant "kind": (statement_declaration.constant
? "const" ? "const"
: "let"), : "let"),
"name": statement_declaration.name, "name": statement_declaration.name,
"macro_export": ((!statement_declaration.export_)
? ""
: "export "),
"macro_type": ((statement_declaration.type === null) "macro_type": ((statement_declaration.type === null)
? "" ? ""
: lib_plankton.string.coin(" : {{type}}", { : lib_plankton.string.coin(" : {{type}}", {

View file

@ -11,18 +11,35 @@ namespace _sindri.outputs.backend.typescript
} }
/**
*/
async function coin(
template_name : string,
values : Record<string, string>
) : Promise<string>
{
return lib_plankton.string.coin(
await get_template(template_name),
values,
{
"open": "<<",
"close": ">>",
}
);
}
/** /**
*/ */
export async function render( export async function render(
input_data input_data
) : Promise<string> ) : Promise<string>
{ {
const conf : { // TODO as command line argument?
const conf_internal : {
namespace_base : string; namespace_base : string;
api_path_base : string;
} = { } = {
"namespace_base": "_sindri.", "namespace_base": "_sindri.",
"api_path_base": "sindri/",
}; };
const map_primitive_type = function (typename : string) : lib_plankton.prog.struct_type { const map_primitive_type = function (typename : string) : lib_plankton.prog.struct_type {
@ -47,7 +64,7 @@ namespace _sindri.outputs.backend.typescript
return lib_plankton.string.coin( return lib_plankton.string.coin(
"{{base}}entities.{{domain_name}}", "{{base}}entities.{{domain_name}}",
{ {
"base": conf.namespace_base, "base": conf_internal.namespace_base,
"domain_name": domain.name, "domain_name": domain.name,
} }
); );
@ -68,7 +85,7 @@ namespace _sindri.outputs.backend.typescript
return lib_plankton.string.coin( return lib_plankton.string.coin(
"{{base}}repositories", "{{base}}repositories",
{ {
"base": conf.namespace_base, "base": conf_internal.namespace_base,
} }
); );
}; };
@ -86,212 +103,202 @@ namespace _sindri.outputs.backend.typescript
); );
}; };
return lib_plankton.string.coin( return coin(
await get_template("master"), "master",
{ {
"namespace_base": conf.namespace_base, "namespace_base": conf_internal.namespace_base,
"entities": ( "entities": (
(await Promise.all( (await Promise.all(
input_data["domains"] input_data["domains"]
.map( .map(
(domain) => ( (domain) => coin(
get_template("entity") "entity",
.then( {
template => lib_plankton.string.coin( "domain_name": domain.name,
template, "defs": lib_plankton.prog.typescript.render_statement(
{ new lib_plankton.prog.struct_statement_type_definition(
"domain_name": domain.name, name_entity_type(false, domain),
"defs": ( new lib_plankton.prog.struct_type_record(
"export " domain.data_fields
+ .map(
lib_plankton.prog.typescript.render_statement( (data_field) => ({
new lib_plankton.prog.struct_statement_type_definition( "name": data_field.name,
name_entity_type(false, domain), "type": (
new lib_plankton.prog.struct_type_record( data_field.nullable
domain.data_fields ? new lib_plankton.prog.struct_type_union(
.map( new lib_plankton.prog.struct_type_literal(
(data_field) => ({ new lib_plankton.prog.struct_expression_literal(
"name": data_field.name, null
"type": ( )
data_field.nullable ),
? new lib_plankton.prog.struct_type_union( map_primitive_type(data_field["type"])
new lib_plankton.prog.struct_type_literal(
new lib_plankton.prog.struct_expression_literal(
null
)
),
map_primitive_type(data_field["type"])
)
: map_primitive_type(data_field["type"])
),
"mandatory": true,
})
) )
) : map_primitive_type(data_field["type"])
), ),
{ "mandatory": true,
"level": 2, })
}
) )
) ),
{
"export": true,
}
),
{
"level": 2,
} }
) )
) }
) )
) )
)).join("") ))
.join("")
), ),
"repositories": ( "repositories": (
(await Promise.all( (await Promise.all(
input_data["domains"] input_data["domains"]
.map( .map(
(domain) => ( (domain) => coin(
get_template("repository") "repository",
.then( {
template => lib_plankton.string.coin( "domain_name": domain.name,
template, "type_name": name_entity_type(true, domain),
{ "table_name": name_table(domain),
"domain_name": domain.name, "list_function_name": name_repository_function(false, domain, "list"),
"type_name": name_entity_type(true, domain), "list_query_fields": (
"table_name": name_table(domain), [domain.key_field.name]
"list_function_name": name_repository_function(false, domain, "list"), .concat(domain.data_fields.map(field => field.name))
"list_query_fields": ( .join(",")
[domain.key_field.name] ),
.concat(domain.data_fields.map(field => field.name)) "list_result": lib_plankton.prog.typescript.render_expression(
.join(",") new lib_plankton.prog.struct_expression_dict(
), [
"list_result": lib_plankton.prog.typescript.render_expression(
new lib_plankton.prog.struct_expression_dict(
[
{
"key": "key",
"value": new lib_plankton.prog.struct_expression_projection(
new lib_plankton.prog.struct_expression_variable("row"),
new lib_plankton.prog.struct_expression_literal(domain.key_field.name)
),
},
{
"key": "value",
"value": new lib_plankton.prog.struct_expression_dict(
domain.data_fields
.map(
(field, index) => ({
"key": field.name,
"value": new lib_plankton.prog.struct_expression_projection(
new lib_plankton.prog.struct_expression_variable("row"),
new lib_plankton.prog.struct_expression_literal(field.name)
)
})
)
),
},
]
),
{ {
"indent": false, "key": "key",
"level": 8, "value": new lib_plankton.prog.struct_expression_projection(
} new lib_plankton.prog.struct_expression_variable("row"),
), new lib_plankton.prog.struct_expression_literal(domain.key_field.name)
"read_function_name": name_repository_function(false, domain, "read"), ),
"read_query_fields": ( },
[]
.concat(domain.data_fields.map(field => field.name))
.join(",")
),
"read_result_fields": lib_plankton.prog.typescript.render_expression(
new lib_plankton.prog.struct_expression_dict(
domain.data_fields
.map(
(field, index) => ({
"key": field.name,
"value": new lib_plankton.prog.struct_expression_projection(
new lib_plankton.prog.struct_expression_variable("row"),
new lib_plankton.prog.struct_expression_literal(field.name)
)
})
)
),
{ {
"indent": false, "key": "value",
"level": 6, "value": new lib_plankton.prog.struct_expression_dict(
}
),
"create_function_name": name_repository_function(false, domain, "create"),
"create_query_field_names": (
domain.data_fields
.map(field => field.name)
.join(",")
),
"create_query_field_placeholders": (
domain.data_fields
.map(field => (":" + field.name))
.join(",")
),
"create_query_field_values": lib_plankton.prog.typescript.render_expression(
new lib_plankton.prog.struct_expression_dict(
domain.data_fields
.map(
field => ({
"key": field.name,
"value": new lib_plankton.prog.struct_expression_fieldaccess(
new lib_plankton.prog.struct_expression_variable("value"),
field.name,
),
})
)
),
{
"indent": false,
"level": 6,
}
),
"update_function_name": name_repository_function(false, domain, "update"),
"update_query_assignments": (
domain.data_fields
.map(
field => lib_plankton.string.coin(
"{{key}} = {{value}}",
{
"key": field.name,
"value": (":" + ("value_" + field.name)),
}
)
)
.join(", ")
),
"update_query_values": lib_plankton.prog.typescript.render_expression(
new lib_plankton.prog.struct_expression_dict(
[]
.concat(
[
{
"key": "key",
"value": new lib_plankton.prog.struct_expression_variable("key"),
},
]
)
.concat(
domain.data_fields domain.data_fields
.map( .map(
field => ({ (field, index) => ({
"key": ("value_" + field.name), "key": field.name,
"value": new lib_plankton.prog.struct_expression_fieldaccess( "value": new lib_plankton.prog.struct_expression_projection(
new lib_plankton.prog.struct_expression_variable("value"), new lib_plankton.prog.struct_expression_variable("row"),
field.name, new lib_plankton.prog.struct_expression_literal(field.name)
), )
}) })
) )
) ),
), },
{ ]
"indent": false, ),
"level": 7, {
} "indent": false,
), "level": 8,
"delete_function_name": name_repository_function(false, domain, "delete"),
} }
) ),
) "read_function_name": name_repository_function(false, domain, "read"),
"read_query_fields": (
[]
.concat(domain.data_fields.map(field => field.name))
.join(",")
),
"read_result_fields": lib_plankton.prog.typescript.render_expression(
new lib_plankton.prog.struct_expression_dict(
domain.data_fields
.map(
(field, index) => ({
"key": field.name,
"value": new lib_plankton.prog.struct_expression_projection(
new lib_plankton.prog.struct_expression_variable("row"),
new lib_plankton.prog.struct_expression_literal(field.name)
)
})
)
),
{
"indent": false,
"level": 6,
}
),
"create_function_name": name_repository_function(false, domain, "create"),
"create_query_field_names": (
domain.data_fields
.map(field => field.name)
.join(",")
),
"create_query_field_placeholders": (
domain.data_fields
.map(field => (":" + field.name))
.join(",")
),
"create_query_field_values": lib_plankton.prog.typescript.render_expression(
new lib_plankton.prog.struct_expression_dict(
domain.data_fields
.map(
field => ({
"key": field.name,
"value": new lib_plankton.prog.struct_expression_fieldaccess(
new lib_plankton.prog.struct_expression_variable("value"),
field.name,
),
})
)
),
{
"indent": false,
"level": 6,
}
),
"update_function_name": name_repository_function(false, domain, "update"),
"update_query_assignments": (
domain.data_fields
.map(
field => lib_plankton.string.coin(
"{{key}} = {{value}}",
{
"key": field.name,
"value": (":" + ("value_" + field.name)),
}
)
)
.join(", ")
),
"update_query_values": lib_plankton.prog.typescript.render_expression(
new lib_plankton.prog.struct_expression_dict(
[]
.concat(
[
{
"key": "key",
"value": new lib_plankton.prog.struct_expression_variable("key"),
},
]
)
.concat(
domain.data_fields
.map(
field => ({
"key": ("value_" + field.name),
"value": new lib_plankton.prog.struct_expression_fieldaccess(
new lib_plankton.prog.struct_expression_variable("value"),
field.name,
),
})
)
)
),
{
"indent": false,
"level": 7,
}
),
"delete_function_name": name_repository_function(false, domain, "delete"),
}
) )
) )
)) ))
@ -301,23 +308,17 @@ namespace _sindri.outputs.backend.typescript
(await Promise.all( (await Promise.all(
input_data["domains"] input_data["domains"]
.map( .map(
(domain) => ( (domain) => coin(
get_template("api") "api",
.then( {
template => lib_plankton.string.coin( "domain_name": domain.name,
template, "type_name": name_entity_type(true, domain),
{ "repository_function_list": name_repository_function(true, domain, "list"),
"domain_name": domain.name, "repository_function_read": name_repository_function(true, domain, "read"),
"type_name": name_entity_type(true, domain), "repository_function_create": name_repository_function(true, domain, "create"),
"path_base": conf.api_path_base, "repository_function_update": name_repository_function(true, domain, "update"),
"repository_function_list": name_repository_function(true, domain, "list"), "repository_function_delete": name_repository_function(true, domain, "delete"),
"repository_function_read": name_repository_function(true, domain, "read"), }
"repository_function_create": name_repository_function(true, domain, "create"),
"repository_function_update": name_repository_function(true, domain, "update"),
"repository_function_delete": name_repository_function(true, domain, "delete"),
}
)
)
) )
) )
)) ))

View file

@ -1,14 +1,20 @@
// {{domain_name}} // <<domain_name>>
{ {
lib_plankton.rest.register( lib_plankton.rest.register(
rest, rest,
lib_plankton.http.enum_method.get, lib_plankton.http.enum_method.get,
"/{{path_base}}{{domain_name}}", lib_plankton.string.coin(
"/{{base_path}}{{domain_name}}",
{
"base_path": _brock.conf.api_base_path,
"domain_name": "<<domain_name>>",
}
),
{ {
"execution": async function (stuff) { "execution": async function (stuff) {
return { return {
"status_code": 200, "status_code": 200,
"data": await {{repository_function_list}}( "data": await <<repository_function_list>>(
) )
}; };
@ -18,12 +24,18 @@
lib_plankton.rest.register( lib_plankton.rest.register(
rest, rest,
lib_plankton.http.enum_method.get, lib_plankton.http.enum_method.get,
"/{{path_base}}{{domain_name}}/:id", lib_plankton.string.coin(
"/{{base_path}}{{domain_name}}/:id",
{
"base_path": _brock.conf.api_base_path,
"domain_name": "<<domain_name>>",
}
),
{ {
"execution": async function (stuff) { "execution": async function (stuff) {
return { return {
"status_code": 200, "status_code": 200,
"data": await {{repository_function_read}}( "data": await <<repository_function_read>>(
parseInt( parseInt(
stuff.path_parameters["id"] stuff.path_parameters["id"]
) )
@ -35,11 +47,17 @@
lib_plankton.rest.register( lib_plankton.rest.register(
rest, rest,
lib_plankton.http.enum_method.post, lib_plankton.http.enum_method.post,
"/{{path_base}}{{domain_name}}", lib_plankton.string.coin(
"/{{base_path}}{{domain_name}}",
{
"base_path": _brock.conf.api_base_path,
"domain_name": "<<domain_name>>",
}
),
{ {
"execution": async function (stuff) { "execution": async function (stuff) {
const id = await {{repository_function_create}}( const id = await <<repository_function_create>>(
(stuff.input as {{type_name}}) (stuff.input as <<type_name>>)
); );
return { return {
"status_code": 201, "status_code": 201,
@ -51,14 +69,20 @@
lib_plankton.rest.register( lib_plankton.rest.register(
rest, rest,
lib_plankton.http.enum_method.patch, lib_plankton.http.enum_method.patch,
"/{{path_base}}{{domain_name}}/:id", lib_plankton.string.coin(
"/{{base_path}}{{domain_name}}/:id",
{
"base_path": _brock.conf.api_base_path,
"domain_name": "<<domain_name>>",
}
),
{ {
"execution": async function (stuff) { "execution": async function (stuff) {
const dummy = await {{repository_function_create}}( const dummy = await <<repository_function_create>>(
parseInt( parseInt(
stuff.path_parameters["id"] stuff.path_parameters["id"]
), ),
(stuff.input as {{type_name}}) (stuff.input as <<type_name>>)
); );
return { return {
"status_code": 200, "status_code": 200,
@ -70,10 +94,16 @@
lib_plankton.rest.register( lib_plankton.rest.register(
rest, rest,
lib_plankton.http.enum_method.delete, lib_plankton.http.enum_method.delete,
"/{{path_base}}{{domain_name}}/:id", lib_plankton.string.coin(
"/{{base_path}}{{domain_name}}/:id",
{
"base_path": _brock.conf.api_base_path,
"domain_name": "<<domain_name>>",
}
),
{ {
"execution": async function (stuff) { "execution": async function (stuff) {
const dummy = await {{repository_function_delete}}( const dummy = await <<repository_function_delete>>(
parseInt( parseInt(
stuff.path_parameters["id"] stuff.path_parameters["id"]
) )

View file

@ -1,4 +1,4 @@
export namespace {{domain_name}} export namespace <<domain_name>>
{ {
{{defs}} <<defs>>
} }

View file

@ -1,18 +1,18 @@
// declare var require; // declare var require;
namespace {{namespace_base}}entities namespace <<namespace_base>>entities
{ {
{{entities}} <<entities>>
} }
namespace {{namespace_base}}repositories namespace <<namespace_base>>repositories
{ {
{{repositories}} <<repositories>>
} }
namespace {{namespace_base}}main namespace <<namespace_base>>main
{ {
// run // run
export function run( export function run(
@ -46,12 +46,12 @@ namespace {{namespace_base}}main
} }
); );
} }
{{api}} <<api>>
} }
// setup server // setup server
const server = lib_plankton.server.make( const server = lib_plankton.server.make(
conf.server_port, _brock.conf.server_port,
async function (input) { async function (input) {
const http_request : lib_plankton.http.type_request = lib_plankton.http.decode_request( const http_request : lib_plankton.http.type_request = lib_plankton.http.decode_request(
input input

View file

@ -1,119 +1,111 @@
export namespace {{domain_name}} export namespace <<domain_name>>
{ {
// list // list
export function {{list_function_name}}( export function <<list_function_name>>(
) : Promise<Array<{key : number; value : {{type_name}};}>> ) : Promise<Array<{key : number; value : <<type_name>>;}>>
{ {
return ( return (
lib_plankton.sqlite.query_get( lib_plankton.sqlite.query_get(
conf.database_path, _brock.conf.database_path,
{ {
"template": "SELECT {{list_query_fields}} FROM {{table_name}};", "template": "SELECT <<list_query_fields>> FROM <<table_name>>;",
"arguments": { "arguments": {
} }
} }
) )
.then( .then(
function (rows) { (rows) => rows.map(
return rows.map( (row) => <<list_result>>
function (row) { )
return {{list_result}};
}
);
}
) )
); );
} }
// read // read
export function {{read_function_name}}( export function <<read_function_name>>(
key : number key : number
) : Promise<{{type_name}}> ) : Promise<<<type_name>>>
{ {
return ( return (
lib_plankton.sqlite.query_get( lib_plankton.sqlite.query_get(
conf.database_path, _brock.conf.database_path,
{ {
"template": "SELECT {{read_query_fields}} FROM {{table_name}} WHERE (id = :key);", "template": "SELECT <<read_query_fields>> FROM <<table_name>> WHERE (id = :key);",
"arguments": { "arguments": {
"key": key "key": key
} }
} }
) )
.then( .then(
function (rows) { (rows) {
const row = rows[0]; const row = rows[0];
return {{read_result_fields}}; return <<read_result_fields>>;
} }
) )
); );
} }
// create // create
export function {{create_function_name}}( export function <<create_function_name>>(
value : {{type_name}} value : <<type_name>>
) : Promise<number> ) : Promise<number>
{ {
return ( return (
lib_plankton.sqlite.query_put( lib_plankton.sqlite.query_put(
conf.database_path, _brock.conf.database_path,
{ {
"template": "INSERT INTO {{table_name}}({{create_query_field_names}}) VALUES ({{create_query_field_placeholders}});", "template": "INSERT INTO <<table_name>>(<<create_query_field_names>>) VALUES (<<create_query_field_placeholders>>);",
"arguments": {{create_query_field_values}} "arguments": <<create_query_field_values>>
} }
) )
.then( .then(
function (result) { (result) => result.id
return result.id;
}
) )
); );
} }
// update // update
export function {{update_function_name}}( export function <<update_function_name>>(
key : number, key : number,
value : {{type_name}} value : <<type_name>>
) : Promise<void> ) : Promise<void>
{ {
return ( return (
lib_plankton.sqlite.query_put( lib_plankton.sqlite.query_put(
conf.database_path, _brock.conf.database_path,
{ {
"template": "UPDATE {{table_name}} SET {{update_query_assignments}} WHERE (id = :key);", "template": "UPDATE <<table_name>> SET <<update_query_assignments>> WHERE (id = :key);",
"arguments": { "arguments": {
"key": key, "key": key,
{{update_query_values}} <<update_query_values>>
} }
} }
) )
.then( .then(
function (result) { (result) => {}
}
) )
); );
} }
// delete // delete
export function {{delete_function_name}}( export function <<delete_function_name>>(
key : number key : number
) : Promise<void> ) : Promise<void>
{ {
return ( return (
lib_plankton.sqlite.query_put( lib_plankton.sqlite.query_put(
conf.database_path, _brock.conf.database_path,
{ {
"template": "DELETE FROM {{table_name}} WHERE (id = :key);", "template": "DELETE FROM <<table_name>> WHERE (id = :key);",
"arguments": { "arguments": {
"key": key "key": key
} }
} }
) )
.then( .then(
function (result) { (result) => {}
}
) )
); );
} }