[upd] plankton
This commit is contained in:
parent
a990286cbd
commit
71c803107c
2 changed files with 203 additions and 126 deletions
51
lib/plankton/plankton.d.ts
vendored
51
lib/plankton/plankton.d.ts
vendored
|
@ -1,15 +1,15 @@
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
declare type int = number;
|
type int = number;
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
declare type float = number;
|
type float = number;
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
declare type type_date = {
|
type type_date = {
|
||||||
year: int;
|
year: int;
|
||||||
month: int;
|
month: int;
|
||||||
day: int;
|
day: int;
|
||||||
|
@ -17,7 +17,7 @@ declare type type_date = {
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
declare type type_time = {
|
type type_time = {
|
||||||
hour: int;
|
hour: int;
|
||||||
minute: int;
|
minute: int;
|
||||||
second: int;
|
second: int;
|
||||||
|
@ -25,7 +25,7 @@ declare type type_time = {
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
declare type type_datetimeobject = {
|
type type_datetimeobject = {
|
||||||
date: type_date;
|
date: type_date;
|
||||||
time: type_time;
|
time: type_time;
|
||||||
};
|
};
|
||||||
|
@ -44,7 +44,7 @@ declare namespace lib_plankton.base {
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
declare type type_pseudopointer<type_value> = {
|
type type_pseudopointer<type_value> = {
|
||||||
value: type_value;
|
value: type_value;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
|
@ -1988,6 +1988,7 @@ declare namespace lib_plankton.database {
|
||||||
type type_description_insert = {
|
type type_description_insert = {
|
||||||
table_name: string;
|
table_name: string;
|
||||||
values: Record<string, any>;
|
values: Record<string, any>;
|
||||||
|
returning?: (null | string);
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
@ -2032,6 +2033,7 @@ declare namespace lib_plankton.database {
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
type type_database = {
|
type type_database = {
|
||||||
|
wrap_name: ((name: string) => string);
|
||||||
query_free_get: ((query: type_query) => Promise<type_result_get>);
|
query_free_get: ((query: type_query) => Promise<type_result_get>);
|
||||||
query_free_put: ((query: type_query) => Promise<type_result_put>);
|
query_free_put: ((query: type_query) => Promise<type_result_put>);
|
||||||
query_free_set: ((query: type_query) => Promise<type_result_set>);
|
query_free_set: ((query: type_query) => Promise<type_result_set>);
|
||||||
|
@ -2053,30 +2055,32 @@ declare namespace lib_plankton.database {
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function sql_common_formulation_create_table(description_create_table: type_description_create_table, options?: {
|
function sql_common_formulation_create_table(description_create_table: type_description_create_table, options?: {
|
||||||
auto_increment_keyword?: string;
|
auto_increment_keyword?: (null | string);
|
||||||
|
auto_increment_special?: (null | string);
|
||||||
omit_comments?: boolean;
|
omit_comments?: boolean;
|
||||||
type_map?: Record<enum_type, string>;
|
type_map?: Record<enum_type, string>;
|
||||||
wrap_names?: boolean;
|
wrap_name?: ((name: string) => string);
|
||||||
}): type_query;
|
}): type_query;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function sql_common_formulation_insert(description_insert: type_description_insert, options?: {
|
function sql_common_formulation_insert(description_insert: type_description_insert, options?: {
|
||||||
wrap_names?: boolean;
|
wrap_name?: ((name: string) => string);
|
||||||
|
set_returning?: boolean;
|
||||||
}): type_query;
|
}): type_query;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function sql_common_formulation_update(description_update: type_description_update, options?: {
|
function sql_common_formulation_update(description_update: type_description_update, options?: {
|
||||||
wrap_names?: boolean;
|
wrap_name?: ((name: string) => string);
|
||||||
}): type_query;
|
}): type_query;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function sql_common_formulation_delete(description_delete: type_description_delete, options?: {
|
function sql_common_formulation_delete(description_delete: type_description_delete, options?: {
|
||||||
wrap_names?: boolean;
|
wrap_name?: ((name: string) => string);
|
||||||
}): type_query;
|
}): type_query;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function sql_common_formulation_select(description_select: type_description_select, options?: {
|
function sql_common_formulation_select(description_select: type_description_select, options?: {
|
||||||
wrap_names?: boolean;
|
wrap_name?: ((name: string) => string);
|
||||||
}): type_query;
|
}): type_query;
|
||||||
}
|
}
|
||||||
declare namespace lib_plankton.database {
|
declare namespace lib_plankton.database {
|
||||||
|
@ -2094,6 +2098,9 @@ declare namespace lib_plankton.database {
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function sqlite_make(parameters: type_sqlite_parameters): type_sqlite_subject;
|
function sqlite_make(parameters: type_sqlite_parameters): type_sqlite_subject;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function sqlite_wrap_name(name: string): string;
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
|
@ -2147,6 +2154,7 @@ declare namespace lib_plankton.database {
|
||||||
class class_sqlite implements interface_database {
|
class class_sqlite implements interface_database {
|
||||||
private subject;
|
private subject;
|
||||||
constructor(parameters: type_sqlite_parameters);
|
constructor(parameters: type_sqlite_parameters);
|
||||||
|
wrap_name(name: any): string;
|
||||||
query_free_get(query: any): Promise<type_result_get>;
|
query_free_get(query: any): Promise<type_result_get>;
|
||||||
query_free_put(query: any): Promise<number>;
|
query_free_put(query: any): Promise<number>;
|
||||||
query_free_set(query: any): Promise<number>;
|
query_free_set(query: any): Promise<number>;
|
||||||
|
@ -2167,7 +2175,7 @@ declare namespace lib_plankton.database {
|
||||||
username: string;
|
username: string;
|
||||||
password: string;
|
password: string;
|
||||||
schema: string;
|
schema: string;
|
||||||
client: any;
|
pool: (null | any);
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @todo
|
* @todo
|
||||||
|
@ -2180,22 +2188,24 @@ declare namespace lib_plankton.database {
|
||||||
schema: string;
|
schema: string;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @see https://node-postgres.com/apis/client#new-client
|
|
||||||
*/
|
*/
|
||||||
function postgresql_make(parameters: type_postgresql_parameters): type_postgresql_subject;
|
function postgresql_make(parameters: type_postgresql_parameters): type_postgresql_subject;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function postgresql_wrap_name(name: string): string;
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
* @see https://node-postgres.com/apis/client#clientquery
|
* @see https://node-postgres.com/apis/pool#poolquery
|
||||||
*/
|
*/
|
||||||
function postgresql_query_free_get(subject: type_postgresql_subject, query: type_query): Promise<type_result_get>;
|
function postgresql_query_free_get(subject: type_postgresql_subject, query: type_query): Promise<type_result_get>;
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
* @see https://node-postgres.com/apis/client#clientquery
|
* @see https://node-postgres.com/apis/pool#poolquery
|
||||||
*/
|
*/
|
||||||
function postgresql_query_free_put(subject: type_postgresql_subject, query: type_query): Promise<type_result_put>;
|
function postgresql_query_free_put(subject: type_postgresql_subject, query: type_query): Promise<type_result_put>;
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
* @see https://node-postgres.com/apis/client#clientquery
|
* @see https://node-postgres.com/apis/pool#poolquery
|
||||||
*/
|
*/
|
||||||
function postgresql_query_free_set(subject: type_postgresql_subject, query: type_query): Promise<type_result_set>;
|
function postgresql_query_free_set(subject: type_postgresql_subject, query: type_query): Promise<type_result_set>;
|
||||||
/**
|
/**
|
||||||
|
@ -2239,6 +2249,7 @@ declare namespace lib_plankton.database {
|
||||||
class class_postgresql implements interface_database {
|
class class_postgresql implements interface_database {
|
||||||
private subject;
|
private subject;
|
||||||
constructor(parameters: type_postgresql_parameters);
|
constructor(parameters: type_postgresql_parameters);
|
||||||
|
wrap_name(name: any): string;
|
||||||
query_free_get(query: any): Promise<type_result_get>;
|
query_free_get(query: any): Promise<type_result_get>;
|
||||||
query_free_put(query: any): Promise<number>;
|
query_free_put(query: any): Promise<number>;
|
||||||
query_free_set(query: any): Promise<number>;
|
query_free_set(query: any): Promise<number>;
|
||||||
|
@ -2265,6 +2276,9 @@ declare namespace lib_plankton.database {
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function mysql_make(parameters: type_mysql_parameters): type_mysql_subject;
|
function mysql_make(parameters: type_mysql_parameters): type_mysql_subject;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function mysql_wrap_name(name: string): string;
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
|
@ -2318,6 +2332,7 @@ declare namespace lib_plankton.database {
|
||||||
class class_mysql implements interface_database {
|
class class_mysql implements interface_database {
|
||||||
private subject;
|
private subject;
|
||||||
constructor(parameters: type_mysql_parameters);
|
constructor(parameters: type_mysql_parameters);
|
||||||
|
wrap_name(name: any): string;
|
||||||
query_free_get(query: any): Promise<type_result_get>;
|
query_free_get(query: any): Promise<type_result_get>;
|
||||||
query_free_put(query: any): Promise<number>;
|
query_free_put(query: any): Promise<number>;
|
||||||
query_free_set(query: any): Promise<number>;
|
query_free_set(query: any): Promise<number>;
|
||||||
|
@ -2487,7 +2502,7 @@ declare namespace lib_plankton.storage.memory {
|
||||||
clear(): Promise<void>;
|
clear(): Promise<void>;
|
||||||
write(key: any, value: any): Promise<boolean>;
|
write(key: any, value: any): Promise<boolean>;
|
||||||
delete(key: any): Promise<void>;
|
delete(key: any): Promise<void>;
|
||||||
read(key: any): Promise<type_item>;
|
read(key: any): Promise<Awaited<type_item>>;
|
||||||
search(term: any): Promise<{
|
search(term: any): Promise<{
|
||||||
key: string;
|
key: string;
|
||||||
preview: string;
|
preview: string;
|
||||||
|
|
|
@ -2207,7 +2207,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||||
function step(op) {
|
function step(op) {
|
||||||
if (f) throw new TypeError("Generator is already executing.");
|
if (f) throw new TypeError("Generator is already executing.");
|
||||||
while (_) try {
|
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
||||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||||
switch (op[0]) {
|
switch (op[0]) {
|
||||||
|
@ -6790,22 +6790,13 @@ var lib_plankton;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
database.sql_common_value_format = sql_common_value_format;
|
database.sql_common_value_format = sql_common_value_format;
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function wrap_name(name, options = {}) {
|
|
||||||
options = Object.assign({
|
|
||||||
"active": true,
|
|
||||||
}, options);
|
|
||||||
return (options.active
|
|
||||||
? ("`" + name + "`")
|
|
||||||
: name);
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function sql_common_formulation_create_table(description_create_table, options = {}) {
|
function sql_common_formulation_create_table(description_create_table, options = {}) {
|
||||||
var _a, _b, _c, _d, _e;
|
var _a, _b, _c, _d, _e, _f;
|
||||||
options = Object.assign({
|
options = Object.assign({
|
||||||
"auto_increment_keyword": "AUTO INCREMENT",
|
"auto_increment_keyword": "AUTO INCREMENT",
|
||||||
|
"auto_increment_special": null,
|
||||||
"omit_comments": false,
|
"omit_comments": false,
|
||||||
"type_map": {
|
"type_map": {
|
||||||
"boolean": "BOOLEAN",
|
"boolean": "BOOLEAN",
|
||||||
|
@ -6815,11 +6806,11 @@ var lib_plankton;
|
||||||
"string_long": "TEXT",
|
"string_long": "TEXT",
|
||||||
"float": "REAL",
|
"float": "REAL",
|
||||||
},
|
},
|
||||||
"wrap_names": true,
|
"wrap_name": (x => x),
|
||||||
}, options);
|
}, options);
|
||||||
return {
|
return {
|
||||||
"template": lib_plankton.string.coin("CREATE TABLE\n\t{{name}}(\n{{entries}}\n\t){{comment}}\n;", {
|
"template": lib_plankton.string.coin("CREATE TABLE IF NOT EXISTS\n\t{{name}}(\n{{entries}}\n\t){{comment}}\n;", {
|
||||||
"name": wrap_name(description_create_table.name, { "active": options.wrap_names }),
|
"name": options.wrap_name(description_create_table.name),
|
||||||
"comment": ((options.omit_comments
|
"comment": ((options.omit_comments
|
||||||
||
|
||
|
||||||
(((_a = description_create_table.description) !== null && _a !== void 0 ? _a : null) === null))
|
(((_a = description_create_table.description) !== null && _a !== void 0 ? _a : null) === null))
|
||||||
|
@ -6832,34 +6823,42 @@ var lib_plankton;
|
||||||
.concat((((_b = description_create_table.key_field) !== null && _b !== void 0 ? _b : null) === null)
|
.concat((((_b = description_create_table.key_field) !== null && _b !== void 0 ? _b : null) === null)
|
||||||
? []
|
? []
|
||||||
: lib_plankton.string.coin("{{name}} {{parameters}}", {
|
: lib_plankton.string.coin("{{name}} {{parameters}}", {
|
||||||
"name": wrap_name(description_create_table.key_field.name, { "active": options.wrap_names }),
|
"name": options.wrap_name(description_create_table.key_field.name),
|
||||||
"parameters": (([]
|
"parameters": (((options.auto_increment_special === null)
|
||||||
/*
|
?
|
||||||
|
([]
|
||||||
// type
|
// type
|
||||||
.concat(
|
.concat([
|
||||||
[
|
options.type_map[(_c = description_create_table.key_field.type) !== null && _c !== void 0 ? _c : "integer"],
|
||||||
options.type_map[description_create_table.key_field.type ?? "integer"],
|
])
|
||||||
]
|
// nullability
|
||||||
)
|
.concat([
|
||||||
*/
|
"NOT NULL",
|
||||||
// auto increment
|
|
||||||
.concat((((_c = description_create_table.key_field.auto_increment) !== null && _c !== void 0 ? _c : true) === null)
|
|
||||||
? []
|
|
||||||
: [
|
|
||||||
options.auto_increment_keyword,
|
|
||||||
])
|
])
|
||||||
// primary key
|
// primary key
|
||||||
.concat([
|
.concat([
|
||||||
"PRIMARY KEY",
|
"PRIMARY KEY",
|
||||||
|
])
|
||||||
|
// auto increment
|
||||||
|
.concat((((_d = description_create_table.key_field.auto_increment) !== null && _d !== void 0 ? _d : true) === null)
|
||||||
|
?
|
||||||
|
[]
|
||||||
|
:
|
||||||
|
[
|
||||||
|
options.auto_increment_keyword,
|
||||||
]))
|
]))
|
||||||
|
:
|
||||||
|
[
|
||||||
|
options.auto_increment_special
|
||||||
|
])
|
||||||
.join(" ")),
|
.join(" ")),
|
||||||
}))
|
}))
|
||||||
// data fields
|
// data fields
|
||||||
.concat(((_d = description_create_table.data_fields) !== null && _d !== void 0 ? _d : [])
|
.concat(((_e = description_create_table.data_fields) !== null && _e !== void 0 ? _e : [])
|
||||||
.map((data_field) => {
|
.map((data_field) => {
|
||||||
var _a, _b;
|
var _a, _b;
|
||||||
return lib_plankton.string.coin("{{name}} {{parameters}}", {
|
return lib_plankton.string.coin("{{name}} {{parameters}}", {
|
||||||
"name": wrap_name(data_field.name, { "active": options.wrap_names }),
|
"name": options.wrap_name(data_field.name),
|
||||||
"parameters": (([]
|
"parameters": (([]
|
||||||
// type
|
// type
|
||||||
.concat([
|
.concat([
|
||||||
|
@ -6891,7 +6890,7 @@ var lib_plankton;
|
||||||
});
|
});
|
||||||
}))
|
}))
|
||||||
// constraints
|
// constraints
|
||||||
.concat(((_e = description_create_table.constraints) !== null && _e !== void 0 ? _e : [])
|
.concat(((_f = description_create_table.constraints) !== null && _f !== void 0 ? _f : [])
|
||||||
.map((constraint) => {
|
.map((constraint) => {
|
||||||
switch (constraint.kind) {
|
switch (constraint.kind) {
|
||||||
default: {
|
default: {
|
||||||
|
@ -6901,11 +6900,11 @@ var lib_plankton;
|
||||||
case "foreign_key": {
|
case "foreign_key": {
|
||||||
return lib_plankton.string.coin("FOREIGN KEY ({{fields}}) REFERENCES {{reference_name}}({{reference_fields}})", {
|
return lib_plankton.string.coin("FOREIGN KEY ({{fields}}) REFERENCES {{reference_name}}({{reference_fields}})", {
|
||||||
"fields": (constraint.parameters["fields"]
|
"fields": (constraint.parameters["fields"]
|
||||||
.map(x => wrap_name(x, { "active": options.wrap_names }))
|
.map(x => options.wrap_name(x))
|
||||||
.join(",")),
|
.join(",")),
|
||||||
"reference_name": wrap_name(constraint.parameters["reference"]["name"], { "active": options.wrap_names }),
|
"reference_name": options.wrap_name(constraint.parameters["reference"]["name"]),
|
||||||
"reference_fields": (constraint.parameters["reference"]["fields"]
|
"reference_fields": (constraint.parameters["reference"]["fields"]
|
||||||
.map(x => wrap_name(x, { "active": options.wrap_names }))
|
.map(x => options.wrap_name(x))
|
||||||
.join(",")),
|
.join(",")),
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
@ -6913,7 +6912,7 @@ var lib_plankton;
|
||||||
case "unique": {
|
case "unique": {
|
||||||
return lib_plankton.string.coin("UNIQUE ({{fields}})", {
|
return lib_plankton.string.coin("UNIQUE ({{fields}})", {
|
||||||
"fields": (constraint.parameters["fields"]
|
"fields": (constraint.parameters["fields"]
|
||||||
.map(x => wrap_name(x, { "active": options.wrap_names }))
|
.map(x => options.wrap_name(x))
|
||||||
.join(",")),
|
.join(",")),
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
@ -6931,15 +6930,16 @@ var lib_plankton;
|
||||||
*/
|
*/
|
||||||
function sql_common_formulation_insert(description_insert, options = {}) {
|
function sql_common_formulation_insert(description_insert, options = {}) {
|
||||||
options = Object.assign({
|
options = Object.assign({
|
||||||
"wrap_names": true,
|
"wrap_name": (x => x),
|
||||||
|
"set_returning": false,
|
||||||
}, options);
|
}, options);
|
||||||
const field_names = Object.keys(description_insert.values);
|
const field_names = Object.keys(description_insert.values);
|
||||||
return {
|
return {
|
||||||
"template": lib_plankton.string.coin("INSERT INTO {{table_name}}({{schema}}) VALUES ({{values}});", {
|
"template": lib_plankton.string.coin("INSERT INTO {{table_name}}({{schema}}) VALUES ({{values}}){{returning}};", {
|
||||||
"table_name": wrap_name(description_insert.table_name, { "active": options.wrap_names }),
|
"table_name": options.wrap_name(description_insert.table_name),
|
||||||
"schema": (field_names
|
"schema": (field_names
|
||||||
.map((field_name) => lib_plankton.string.coin("{{name}}", {
|
.map((field_name) => lib_plankton.string.coin("{{name}}", {
|
||||||
"name": wrap_name(field_name, { "active": options.wrap_names }),
|
"name": options.wrap_name(field_name),
|
||||||
}))
|
}))
|
||||||
.join(",")),
|
.join(",")),
|
||||||
"values": (field_names
|
"values": (field_names
|
||||||
|
@ -6947,6 +6947,15 @@ var lib_plankton;
|
||||||
"name": field_name,
|
"name": field_name,
|
||||||
}))
|
}))
|
||||||
.join(",")),
|
.join(",")),
|
||||||
|
"returning": ((options.set_returning
|
||||||
|
&&
|
||||||
|
((description_insert.returning !== undefined)
|
||||||
|
&&
|
||||||
|
(description_insert.returning !== null)))
|
||||||
|
?
|
||||||
|
(" RETURNING " + description_insert.returning)
|
||||||
|
:
|
||||||
|
""),
|
||||||
}),
|
}),
|
||||||
"arguments": Object.fromEntries(Object.entries(description_insert.values)
|
"arguments": Object.fromEntries(Object.entries(description_insert.values)
|
||||||
.map(([name, value]) => ([
|
.map(([name, value]) => ([
|
||||||
|
@ -6963,15 +6972,15 @@ var lib_plankton;
|
||||||
function sql_common_formulation_update(description_update, options = {}) {
|
function sql_common_formulation_update(description_update, options = {}) {
|
||||||
var _a, _b;
|
var _a, _b;
|
||||||
options = Object.assign({
|
options = Object.assign({
|
||||||
"wrap_names": true,
|
"wrap_name": (x => x),
|
||||||
}, options);
|
}, options);
|
||||||
const field_names = Object.keys(description_update.values);
|
const field_names = Object.keys(description_update.values);
|
||||||
return {
|
return {
|
||||||
"template": lib_plankton.string.coin("UPDATE {{table_name}} SET {{assignments}}{{macro_where}};", {
|
"template": lib_plankton.string.coin("UPDATE {{table_name}} SET {{assignments}}{{macro_where}};", {
|
||||||
"table_name": wrap_name(description_update.table_name, { "active": options.wrap_names }),
|
"table_name": options.wrap_name(description_update.table_name),
|
||||||
"assignments": (field_names
|
"assignments": (field_names
|
||||||
.map((field_name) => lib_plankton.string.coin("{{name}} = $value_{{suffix}}", {
|
.map((field_name) => lib_plankton.string.coin("{{name}} = $value_{{suffix}}", {
|
||||||
"name": wrap_name(field_name, { "active": options.wrap_names }),
|
"name": options.wrap_name(field_name),
|
||||||
"suffix": field_name,
|
"suffix": field_name,
|
||||||
}))
|
}))
|
||||||
.join(", ")),
|
.join(", ")),
|
||||||
|
@ -6996,11 +7005,11 @@ var lib_plankton;
|
||||||
function sql_common_formulation_delete(description_delete, options = {}) {
|
function sql_common_formulation_delete(description_delete, options = {}) {
|
||||||
var _a, _b;
|
var _a, _b;
|
||||||
options = Object.assign({
|
options = Object.assign({
|
||||||
"wrap_names": true,
|
"wrap_name": (x => x),
|
||||||
}, options);
|
}, options);
|
||||||
return {
|
return {
|
||||||
"template": lib_plankton.string.coin("DELETE FROM {{table_name}}{{macro_where}};", {
|
"template": lib_plankton.string.coin("DELETE FROM {{table_name}}{{macro_where}};", {
|
||||||
"table_name": wrap_name(description_delete.table_name, { "active": options.wrap_names }),
|
"table_name": options.wrap_name(description_delete.table_name),
|
||||||
"macro_where": ((((_a = description_delete.condition) !== null && _a !== void 0 ? _a : null) === null)
|
"macro_where": ((((_a = description_delete.condition) !== null && _a !== void 0 ? _a : null) === null)
|
||||||
? ""
|
? ""
|
||||||
: lib_plankton.string.coin(" WHERE {{expression}}", {
|
: lib_plankton.string.coin(" WHERE {{expression}}", {
|
||||||
|
@ -7016,15 +7025,15 @@ var lib_plankton;
|
||||||
function sql_common_formulation_select(description_select, options = {}) {
|
function sql_common_formulation_select(description_select, options = {}) {
|
||||||
var _a, _b, _c, _d, _e, _f, _g;
|
var _a, _b, _c, _d, _e, _f, _g;
|
||||||
options = Object.assign({
|
options = Object.assign({
|
||||||
"wrap_names": true,
|
"wrap_name": (x => x),
|
||||||
}, options);
|
}, options);
|
||||||
return {
|
return {
|
||||||
"template": lib_plankton.string.coin("SELECT {{fields}} FROM {{source}}{{macro_where}}{{macro_group_by}}{{macro_having}}{{macro_order_by}}{{macro_limit}};", {
|
"template": lib_plankton.string.coin("SELECT {{fields}} FROM {{source}}{{macro_where}}{{macro_group_by}}{{macro_having}}{{macro_order_by}}{{macro_limit}};", {
|
||||||
"source": wrap_name(description_select.source, { "active": options.wrap_names }),
|
"source": options.wrap_name(description_select.source),
|
||||||
"fields": ((((_a = description_select.fields) !== null && _a !== void 0 ? _a : null) === null)
|
"fields": ((((_a = description_select.fields) !== null && _a !== void 0 ? _a : null) === null)
|
||||||
? "*"
|
? "*"
|
||||||
: (description_select.fields
|
: (description_select.fields
|
||||||
.map(field_name => lib_plankton.string.coin("{{name}}", { "name": wrap_name(field_name, { "active": options.wrap_names }) }))
|
.map(field_name => lib_plankton.string.coin("{{name}}", { "name": options.wrap_name(field_name) }))
|
||||||
.join(","))),
|
.join(","))),
|
||||||
"macro_where": ((((_b = description_select.condition) !== null && _b !== void 0 ? _b : null) === null)
|
"macro_where": ((((_b = description_select.condition) !== null && _b !== void 0 ? _b : null) === null)
|
||||||
? ""
|
? ""
|
||||||
|
@ -7090,6 +7099,12 @@ var lib_plankton;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
database.sqlite_make = sqlite_make;
|
database.sqlite_make = sqlite_make;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function sqlite_wrap_name(name) {
|
||||||
|
return ("`" + name + "`");
|
||||||
|
}
|
||||||
|
database.sqlite_wrap_name = sqlite_wrap_name;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function sqlite_init(subject) {
|
function sqlite_init(subject) {
|
||||||
|
@ -7198,7 +7213,8 @@ var lib_plankton;
|
||||||
*/
|
*/
|
||||||
function sqlite_formulation_create_table(description_create_table) {
|
function sqlite_formulation_create_table(description_create_table) {
|
||||||
return database.sql_common_formulation_create_table(description_create_table, {
|
return database.sql_common_formulation_create_table(description_create_table, {
|
||||||
"auto_increment_keyword": "INTEGER NOT NULL AUTOINCREMENT",
|
"auto_increment_keyword": "AUTOINCREMENT",
|
||||||
|
"auto_increment_special": null,
|
||||||
"omit_comments": true,
|
"omit_comments": true,
|
||||||
"type_map": {
|
"type_map": {
|
||||||
"boolean": "INTEGER",
|
"boolean": "INTEGER",
|
||||||
|
@ -7208,6 +7224,7 @@ var lib_plankton;
|
||||||
"string_long": "TEXT",
|
"string_long": "TEXT",
|
||||||
"float": "REAL",
|
"float": "REAL",
|
||||||
},
|
},
|
||||||
|
"wrap_name": sqlite_wrap_name,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
database.sqlite_formulation_create_table = sqlite_formulation_create_table;
|
database.sqlite_formulation_create_table = sqlite_formulation_create_table;
|
||||||
|
@ -7221,7 +7238,9 @@ var lib_plankton;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function sqlite_formulation_insert(description_insert) {
|
function sqlite_formulation_insert(description_insert) {
|
||||||
return database.sql_common_formulation_insert(description_insert);
|
return database.sql_common_formulation_insert(description_insert, {
|
||||||
|
"wrap_name": sqlite_wrap_name,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
database.sqlite_formulation_insert = sqlite_formulation_insert;
|
database.sqlite_formulation_insert = sqlite_formulation_insert;
|
||||||
/**
|
/**
|
||||||
|
@ -7233,7 +7252,9 @@ var lib_plankton;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function sqlite_formulation_update(description_update) {
|
function sqlite_formulation_update(description_update) {
|
||||||
return database.sql_common_formulation_update(description_update);
|
return database.sql_common_formulation_update(description_update, {
|
||||||
|
"wrap_name": sqlite_wrap_name,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
database.sqlite_formulation_update = sqlite_formulation_update;
|
database.sqlite_formulation_update = sqlite_formulation_update;
|
||||||
/**
|
/**
|
||||||
|
@ -7245,7 +7266,9 @@ var lib_plankton;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function sqlite_formulation_delete(description_delete) {
|
function sqlite_formulation_delete(description_delete) {
|
||||||
return database.sql_common_formulation_delete(description_delete);
|
return database.sql_common_formulation_delete(description_delete, {
|
||||||
|
"wrap_name": sqlite_wrap_name,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
database.sqlite_formulation_delete = sqlite_formulation_delete;
|
database.sqlite_formulation_delete = sqlite_formulation_delete;
|
||||||
/**
|
/**
|
||||||
|
@ -7257,7 +7280,9 @@ var lib_plankton;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function sqlite_formulation_select(description_select) {
|
function sqlite_formulation_select(description_select) {
|
||||||
return database.sql_common_formulation_select(description_select);
|
return database.sql_common_formulation_select(description_select, {
|
||||||
|
"wrap_name": sqlite_wrap_name,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
database.sqlite_formulation_select = sqlite_formulation_select;
|
database.sqlite_formulation_select = sqlite_formulation_select;
|
||||||
/**
|
/**
|
||||||
|
@ -7271,6 +7296,7 @@ var lib_plankton;
|
||||||
function sqlite_database(parameters) {
|
function sqlite_database(parameters) {
|
||||||
const subject = sqlite_make(parameters);
|
const subject = sqlite_make(parameters);
|
||||||
return {
|
return {
|
||||||
|
"wrap_name": (name) => sqlite_wrap_name(name),
|
||||||
"query_free_get": (query) => sqlite_query_free_get(subject, query),
|
"query_free_get": (query) => sqlite_query_free_get(subject, query),
|
||||||
"query_free_put": (query) => sqlite_query_free_put(subject, query),
|
"query_free_put": (query) => sqlite_query_free_put(subject, query),
|
||||||
"query_free_set": (query) => sqlite_query_free_set(subject, query),
|
"query_free_set": (query) => sqlite_query_free_set(subject, query),
|
||||||
|
@ -7312,6 +7338,7 @@ var lib_plankton;
|
||||||
*/
|
*/
|
||||||
class class_sqlite {
|
class class_sqlite {
|
||||||
constructor(parameters) { this.subject = database.sqlite_make(parameters); }
|
constructor(parameters) { this.subject = database.sqlite_make(parameters); }
|
||||||
|
wrap_name(name) { return database.sqlite_wrap_name(name); }
|
||||||
query_free_get(query) { return database.sqlite_query_free_get(this.subject, query); }
|
query_free_get(query) { return database.sqlite_query_free_get(this.subject, query); }
|
||||||
query_free_put(query) { return database.sqlite_query_free_put(this.subject, query); }
|
query_free_put(query) { return database.sqlite_query_free_put(this.subject, query); }
|
||||||
query_free_set(query) { return database.sqlite_query_free_set(this.subject, query); }
|
query_free_set(query) { return database.sqlite_query_free_set(this.subject, query); }
|
||||||
|
@ -7348,7 +7375,6 @@ var lib_plankton;
|
||||||
var database;
|
var database;
|
||||||
(function (database) {
|
(function (database) {
|
||||||
/**
|
/**
|
||||||
* @see https://node-postgres.com/apis/client#new-client
|
|
||||||
*/
|
*/
|
||||||
function postgresql_make(parameters) {
|
function postgresql_make(parameters) {
|
||||||
var _a;
|
var _a;
|
||||||
|
@ -7358,17 +7384,24 @@ var lib_plankton;
|
||||||
"username": parameters.username,
|
"username": parameters.username,
|
||||||
"password": parameters.password,
|
"password": parameters.password,
|
||||||
"schema": parameters.schema,
|
"schema": parameters.schema,
|
||||||
"client": null,
|
"pool": null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
database.postgresql_make = postgresql_make;
|
database.postgresql_make = postgresql_make;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
function postgresql_wrap_name(name) {
|
||||||
|
return ("" + name + "");
|
||||||
|
}
|
||||||
|
database.postgresql_wrap_name = postgresql_wrap_name;
|
||||||
|
/**
|
||||||
|
* https://node-postgres.com/apis/pool
|
||||||
|
*/
|
||||||
function postgresql_init(subject) {
|
function postgresql_init(subject) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (subject.client === null) {
|
if (subject.pool === null) {
|
||||||
const nm_pg = require("pg");
|
const nm_pg = require("pg");
|
||||||
subject.client = (new nm_pg.Client({
|
subject.pool = (new nm_pg.Pool({
|
||||||
"host": subject.host,
|
"host": subject.host,
|
||||||
"port": subject.port,
|
"port": subject.port,
|
||||||
"database": subject.schema,
|
"database": subject.schema,
|
||||||
|
@ -7417,58 +7450,54 @@ var lib_plankton;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
* @see https://node-postgres.com/apis/client#clientquery
|
* @see https://node-postgres.com/apis/pool#poolquery
|
||||||
*/
|
*/
|
||||||
function postgresql_query_free_get(subject, query) {
|
function postgresql_query_free_get(subject, query) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
yield postgresql_init(subject);
|
yield postgresql_init(subject);
|
||||||
const query_adjusted = postgresql_adjust_query(subject, query);
|
const query_adjusted = postgresql_adjust_query(subject, query);
|
||||||
yield subject.client.connect();
|
const result = yield subject.pool.query({
|
||||||
const result = yield subject.client.query({
|
|
||||||
"text": query_adjusted.template,
|
"text": query_adjusted.template,
|
||||||
"values": query_adjusted.arguments,
|
"values": query_adjusted.arguments,
|
||||||
});
|
});
|
||||||
yield subject.client.end();
|
|
||||||
return result["rows"];
|
return result["rows"];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
database.postgresql_query_free_get = postgresql_query_free_get;
|
database.postgresql_query_free_get = postgresql_query_free_get;
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
* @see https://node-postgres.com/apis/client#clientquery
|
* @see https://node-postgres.com/apis/pool#poolquery
|
||||||
*/
|
*/
|
||||||
function postgresql_query_free_put(subject, query) {
|
function postgresql_query_free_put(subject, query) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
yield postgresql_init(subject);
|
yield postgresql_init(subject);
|
||||||
const query_adjusted = postgresql_adjust_query(subject, query);
|
const query_adjusted = postgresql_adjust_query(subject, query);
|
||||||
yield subject.client.connect();
|
const result = yield subject.pool.query(query_adjusted.template, query_adjusted.arguments);
|
||||||
const result1 = yield subject.client.query({
|
if (result["rows"].length <= 0) {
|
||||||
"text": query_adjusted.template,
|
return null;
|
||||||
"values": query_adjusted.arguments,
|
}
|
||||||
});
|
else {
|
||||||
const result2 = yield subject.client.query({
|
const x = result["rows"][0];
|
||||||
"text": "LASTVAL();",
|
const keys = Object.keys(x);
|
||||||
"values": {},
|
if (keys.length <= 0) {
|
||||||
});
|
return null;
|
||||||
yield subject.client.end();
|
}
|
||||||
return result2["rows"][0]["LASTVAL"];
|
else {
|
||||||
|
return x[Object.keys(x)[0]];
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
database.postgresql_query_free_put = postgresql_query_free_put;
|
database.postgresql_query_free_put = postgresql_query_free_put;
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
* @see https://node-postgres.com/apis/client#clientquery
|
* @see https://node-postgres.com/apis/pool#poolquery
|
||||||
*/
|
*/
|
||||||
function postgresql_query_free_set(subject, query) {
|
function postgresql_query_free_set(subject, query) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
yield postgresql_init(subject);
|
yield postgresql_init(subject);
|
||||||
const query_adjusted = postgresql_adjust_query(subject, query);
|
const query_adjusted = postgresql_adjust_query(subject, query);
|
||||||
yield subject.client.connect();
|
const result = yield subject.pool.query(query_adjusted.template, query_adjusted.arguments);
|
||||||
const result = yield subject.client.query({
|
|
||||||
"text": query_adjusted.template,
|
|
||||||
"values": query_adjusted.arguments,
|
|
||||||
});
|
|
||||||
yield subject.client.end();
|
|
||||||
return result["rowCount"];
|
return result["rowCount"];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -7477,7 +7506,8 @@ var lib_plankton;
|
||||||
*/
|
*/
|
||||||
function postgresql_formulation_create_table(description_create_table) {
|
function postgresql_formulation_create_table(description_create_table) {
|
||||||
return database.sql_common_formulation_create_table(description_create_table, {
|
return database.sql_common_formulation_create_table(description_create_table, {
|
||||||
"auto_increment_keyword": "SERIAL",
|
"auto_increment_keyword": "",
|
||||||
|
"auto_increment_special": "SERIAL",
|
||||||
"omit_comments": false,
|
"omit_comments": false,
|
||||||
"type_map": {
|
"type_map": {
|
||||||
"boolean": "BOOLEAN",
|
"boolean": "BOOLEAN",
|
||||||
|
@ -7487,7 +7517,7 @@ var lib_plankton;
|
||||||
"string_long": "TEXT",
|
"string_long": "TEXT",
|
||||||
"float": "REAL",
|
"float": "REAL",
|
||||||
},
|
},
|
||||||
"wrap_names": false,
|
"wrap_name": postgresql_wrap_name,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
database.postgresql_formulation_create_table = postgresql_formulation_create_table;
|
database.postgresql_formulation_create_table = postgresql_formulation_create_table;
|
||||||
|
@ -7501,7 +7531,10 @@ var lib_plankton;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function postgresql_formulation_insert(description_insert) {
|
function postgresql_formulation_insert(description_insert) {
|
||||||
return database.sql_common_formulation_insert(description_insert, { "wrap_names": false });
|
return database.sql_common_formulation_insert(description_insert, {
|
||||||
|
"wrap_name": postgresql_wrap_name,
|
||||||
|
"set_returning": true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
database.postgresql_formulation_insert = postgresql_formulation_insert;
|
database.postgresql_formulation_insert = postgresql_formulation_insert;
|
||||||
/**
|
/**
|
||||||
|
@ -7513,7 +7546,9 @@ var lib_plankton;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function postgresql_formulation_update(description_update) {
|
function postgresql_formulation_update(description_update) {
|
||||||
return database.sql_common_formulation_update(description_update, { "wrap_names": false });
|
return database.sql_common_formulation_update(description_update, {
|
||||||
|
"wrap_name": postgresql_wrap_name,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
database.postgresql_formulation_update = postgresql_formulation_update;
|
database.postgresql_formulation_update = postgresql_formulation_update;
|
||||||
/**
|
/**
|
||||||
|
@ -7525,7 +7560,9 @@ var lib_plankton;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function postgresql_formulation_delete(description_delete) {
|
function postgresql_formulation_delete(description_delete) {
|
||||||
return database.sql_common_formulation_delete(description_delete, { "wrap_names": false });
|
return database.sql_common_formulation_delete(description_delete, {
|
||||||
|
"wrap_name": postgresql_wrap_name,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
database.postgresql_formulation_delete = postgresql_formulation_delete;
|
database.postgresql_formulation_delete = postgresql_formulation_delete;
|
||||||
/**
|
/**
|
||||||
|
@ -7537,7 +7574,9 @@ var lib_plankton;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function postgresql_formulation_select(description_select) {
|
function postgresql_formulation_select(description_select) {
|
||||||
return database.sql_common_formulation_select(description_select, { "wrap_names": false });
|
return database.sql_common_formulation_select(description_select, {
|
||||||
|
"wrap_name": postgresql_wrap_name,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
database.postgresql_formulation_select = postgresql_formulation_select;
|
database.postgresql_formulation_select = postgresql_formulation_select;
|
||||||
/**
|
/**
|
||||||
|
@ -7551,6 +7590,7 @@ var lib_plankton;
|
||||||
function postgresql_database(parameters) {
|
function postgresql_database(parameters) {
|
||||||
const subject = postgresql_make(parameters);
|
const subject = postgresql_make(parameters);
|
||||||
return {
|
return {
|
||||||
|
"wrap_name": (name) => postgresql_wrap_name(name),
|
||||||
"query_free_get": (query) => postgresql_query_free_get(subject, query),
|
"query_free_get": (query) => postgresql_query_free_get(subject, query),
|
||||||
"query_free_put": (query) => postgresql_query_free_put(subject, query),
|
"query_free_put": (query) => postgresql_query_free_put(subject, query),
|
||||||
"query_free_set": (query) => postgresql_query_free_set(subject, query),
|
"query_free_set": (query) => postgresql_query_free_set(subject, query),
|
||||||
|
@ -7592,6 +7632,7 @@ var lib_plankton;
|
||||||
*/
|
*/
|
||||||
class class_postgresql {
|
class class_postgresql {
|
||||||
constructor(parameters) { this.subject = database.postgresql_make(parameters); }
|
constructor(parameters) { this.subject = database.postgresql_make(parameters); }
|
||||||
|
wrap_name(name) { return database.postgresql_wrap_name(name); }
|
||||||
query_free_get(query) { return database.postgresql_query_free_get(this.subject, query); }
|
query_free_get(query) { return database.postgresql_query_free_get(this.subject, query); }
|
||||||
query_free_put(query) { return database.postgresql_query_free_put(this.subject, query); }
|
query_free_put(query) { return database.postgresql_query_free_put(this.subject, query); }
|
||||||
query_free_set(query) { return database.postgresql_query_free_set(this.subject, query); }
|
query_free_set(query) { return database.postgresql_query_free_set(this.subject, query); }
|
||||||
|
@ -7633,6 +7674,12 @@ var lib_plankton;
|
||||||
throw (new Error("not implemented"));
|
throw (new Error("not implemented"));
|
||||||
}
|
}
|
||||||
database.mysql_make = mysql_make;
|
database.mysql_make = mysql_make;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function mysql_wrap_name(name) {
|
||||||
|
return ("`" + name + "`");
|
||||||
|
}
|
||||||
|
database.mysql_wrap_name = mysql_wrap_name;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function mysql_init(subject) {
|
function mysql_init(subject) {
|
||||||
|
@ -7690,6 +7737,7 @@ var lib_plankton;
|
||||||
"string_long": "TEXT",
|
"string_long": "TEXT",
|
||||||
"float": "REAL",
|
"float": "REAL",
|
||||||
},
|
},
|
||||||
|
"wrap_name": mysql_wrap_name,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
database.mysql_formulation_create_table = mysql_formulation_create_table;
|
database.mysql_formulation_create_table = mysql_formulation_create_table;
|
||||||
|
@ -7703,7 +7751,9 @@ var lib_plankton;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function mysql_formulation_insert(description_insert) {
|
function mysql_formulation_insert(description_insert) {
|
||||||
return database.sql_common_formulation_insert(description_insert);
|
return database.sql_common_formulation_insert(description_insert, {
|
||||||
|
"wrap_name": mysql_wrap_name,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
database.mysql_formulation_insert = mysql_formulation_insert;
|
database.mysql_formulation_insert = mysql_formulation_insert;
|
||||||
/**
|
/**
|
||||||
|
@ -7715,7 +7765,9 @@ var lib_plankton;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function mysql_formulation_update(description_update) {
|
function mysql_formulation_update(description_update) {
|
||||||
return database.sql_common_formulation_update(description_update);
|
return database.sql_common_formulation_update(description_update, {
|
||||||
|
"wrap_name": mysql_wrap_name,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
database.mysql_formulation_update = mysql_formulation_update;
|
database.mysql_formulation_update = mysql_formulation_update;
|
||||||
/**
|
/**
|
||||||
|
@ -7727,7 +7779,9 @@ var lib_plankton;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function mysql_formulation_delete(description_delete) {
|
function mysql_formulation_delete(description_delete) {
|
||||||
return database.sql_common_formulation_delete(description_delete);
|
return database.sql_common_formulation_delete(description_delete, {
|
||||||
|
"wrap_name": mysql_wrap_name,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
database.mysql_formulation_delete = mysql_formulation_delete;
|
database.mysql_formulation_delete = mysql_formulation_delete;
|
||||||
/**
|
/**
|
||||||
|
@ -7739,7 +7793,9 @@ var lib_plankton;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function mysql_formulation_select(description_select) {
|
function mysql_formulation_select(description_select) {
|
||||||
return database.sql_common_formulation_select(description_select);
|
return database.sql_common_formulation_select(description_select, {
|
||||||
|
"wrap_name": mysql_wrap_name,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
database.mysql_formulation_select = mysql_formulation_select;
|
database.mysql_formulation_select = mysql_formulation_select;
|
||||||
/**
|
/**
|
||||||
|
@ -7753,6 +7809,7 @@ var lib_plankton;
|
||||||
function mysql_database(parameters) {
|
function mysql_database(parameters) {
|
||||||
const subject = mysql_make(parameters);
|
const subject = mysql_make(parameters);
|
||||||
return {
|
return {
|
||||||
|
"wrap_name": (name) => mysql_wrap_name(name),
|
||||||
"query_free_get": (query) => mysql_query_free_get(subject, query),
|
"query_free_get": (query) => mysql_query_free_get(subject, query),
|
||||||
"query_free_put": (query) => mysql_query_free_put(subject, query),
|
"query_free_put": (query) => mysql_query_free_put(subject, query),
|
||||||
"query_free_set": (query) => mysql_query_free_set(subject, query),
|
"query_free_set": (query) => mysql_query_free_set(subject, query),
|
||||||
|
@ -7794,6 +7851,7 @@ var lib_plankton;
|
||||||
*/
|
*/
|
||||||
class class_mysql {
|
class class_mysql {
|
||||||
constructor(parameters) { this.subject = database.mysql_make(parameters); }
|
constructor(parameters) { this.subject = database.mysql_make(parameters); }
|
||||||
|
wrap_name(name) { return database.mysql_wrap_name(name); }
|
||||||
query_free_get(query) { return database.mysql_query_free_get(this.subject, query); }
|
query_free_get(query) { return database.mysql_query_free_get(this.subject, query); }
|
||||||
query_free_put(query) { return database.mysql_query_free_put(this.subject, query); }
|
query_free_put(query) { return database.mysql_query_free_put(this.subject, query); }
|
||||||
query_free_set(query) { return database.mysql_query_free_set(this.subject, query); }
|
query_free_set(query) { return database.mysql_query_free_set(this.subject, query); }
|
||||||
|
@ -7821,7 +7879,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||||
function step(op) {
|
function step(op) {
|
||||||
if (f) throw new TypeError("Generator is already executing.");
|
if (f) throw new TypeError("Generator is already executing.");
|
||||||
while (_) try {
|
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
||||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||||
switch (op[0]) {
|
switch (op[0]) {
|
||||||
|
@ -8234,7 +8292,8 @@ var lib_plankton;
|
||||||
return __generator(this, function (_a) {
|
return __generator(this, function (_a) {
|
||||||
return [2 /*return*/, subject.database_implementation.query_insert({
|
return [2 /*return*/, subject.database_implementation.query_insert({
|
||||||
"table_name": subject.table_name,
|
"table_name": subject.table_name,
|
||||||
"values": value
|
"values": value,
|
||||||
|
"returning": subject.key_name
|
||||||
})];
|
})];
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -8248,8 +8307,8 @@ var lib_plankton;
|
||||||
return [2 /*return*/, (subject.database_implementation.query_update({
|
return [2 /*return*/, (subject.database_implementation.query_update({
|
||||||
"table_name": subject.table_name,
|
"table_name": subject.table_name,
|
||||||
"values": value,
|
"values": value,
|
||||||
"condition": lib_plankton.string.coin("`{{key_name}}` = $key", {
|
"condition": lib_plankton.string.coin("{{key_name}} = $key", {
|
||||||
"key_name": subject.key_name
|
"key_name": subject.database_implementation.wrap_name(subject.key_name)
|
||||||
}),
|
}),
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"key": key
|
"key": key
|
||||||
|
@ -8268,8 +8327,8 @@ var lib_plankton;
|
||||||
switch (_a.label) {
|
switch (_a.label) {
|
||||||
case 0: return [4 /*yield*/, subject.database_implementation.query_delete({
|
case 0: return [4 /*yield*/, subject.database_implementation.query_delete({
|
||||||
"table_name": subject.table_name,
|
"table_name": subject.table_name,
|
||||||
"condition": lib_plankton.string.coin("`{{key_name}}` = $key", {
|
"condition": lib_plankton.string.coin("{{key_name}} = $key", {
|
||||||
"key_name": subject.key_name
|
"key_name": subject.database_implementation.wrap_name(subject.key_name)
|
||||||
}),
|
}),
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"key": key
|
"key": key
|
||||||
|
@ -8293,8 +8352,8 @@ var lib_plankton;
|
||||||
case 0: return [4 /*yield*/, subject.database_implementation.query_select({
|
case 0: return [4 /*yield*/, subject.database_implementation.query_select({
|
||||||
"source": subject.table_name,
|
"source": subject.table_name,
|
||||||
"fields": null,
|
"fields": null,
|
||||||
"condition": lib_plankton.string.coin("`{{key_name}}` = $key", {
|
"condition": lib_plankton.string.coin("{{key_name}} = $key", {
|
||||||
"key_name": subject.key_name
|
"key_name": subject.database_implementation.wrap_name(subject.key_name)
|
||||||
}),
|
}),
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"key": key
|
"key": key
|
||||||
|
@ -8442,8 +8501,9 @@ var lib_plankton;
|
||||||
return {
|
return {
|
||||||
"condition": lib_string.coin("({{clauses}})", {
|
"condition": lib_string.coin("({{clauses}})", {
|
||||||
"clauses": (subject.key_names
|
"clauses": (subject.key_names
|
||||||
.map(function (key_name) { return lib_plankton.string.coin("(`{{name}}` = $key_{{name}})", {
|
.map(function (key_name) { return lib_plankton.string.coin("({{name1}} = $key_{{name2}})", {
|
||||||
"name": key_name
|
"name1": subject.database_implementation.wrap_name(key_name),
|
||||||
|
"name2": key_name
|
||||||
}); })
|
}); })
|
||||||
.join(" AND "))
|
.join(" AND "))
|
||||||
}),
|
}),
|
||||||
|
@ -8692,7 +8752,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||||
function step(op) {
|
function step(op) {
|
||||||
if (f) throw new TypeError("Generator is already executing.");
|
if (f) throw new TypeError("Generator is already executing.");
|
||||||
while (_) try {
|
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
||||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||||
switch (op[0]) {
|
switch (op[0]) {
|
||||||
|
@ -10002,7 +10062,8 @@ var lib_plankton;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const body = ([http.enum_method.post, http.enum_method.put, http.enum_method.patch].includes(method)
|
const body = ([http.enum_method.post, http.enum_method.put, http.enum_method.patch].includes(method)
|
||||||
? Buffer["from"](lines.join(linebreak))
|
// @ts-ignore
|
||||||
|
? Buffer.from(lines.join(linebreak))
|
||||||
: null);
|
: null);
|
||||||
const request = {
|
const request = {
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -10063,7 +10124,8 @@ var lib_plankton;
|
||||||
headers[key.toLowerCase()] = value;
|
headers[key.toLowerCase()] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const body = Buffer["from"](lines.join(linebreak));
|
// @ts-ignore
|
||||||
|
const body = Buffer.from(lines.join(linebreak));
|
||||||
const response = {
|
const response = {
|
||||||
// TODO
|
// TODO
|
||||||
"version": version,
|
"version": version,
|
||||||
|
|
Loading…
Add table
Reference in a new issue