From 2fb6cd6e836231fde82ac3b8ff3daa371630639c Mon Sep 17 00:00:00 2001 From: Mathis Date: Tue, 30 Apr 2024 16:14:29 +0200 Subject: [PATCH] feat(interfaces): add IDbFactorize interfaces Added IDbFactorizeOutput and IDbFactorizeInput interfaces to handle inputs and outputs of the SQL query factorization function. Both interfaces contain various properties for customizing the SQL query and its error handling behavior. Issue: #18 Signed-off-by: Mathis --- src/interfaces/database/IDbFactorize.ts | 48 +++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/interfaces/database/IDbFactorize.ts diff --git a/src/interfaces/database/IDbFactorize.ts b/src/interfaces/database/IDbFactorize.ts new file mode 100644 index 0000000..b784242 --- /dev/null +++ b/src/interfaces/database/IDbFactorize.ts @@ -0,0 +1,48 @@ +/** + * Represents the output of the factorization function. + */ +export interface IDbFactorizeOutput { + /** + * Description: The variable `_valuesArray` is an array that can contain values of type `string`, `boolean`, `number`, or `Date`. + * (The value associated with the keys of `_keysTemplate`) + * + * @type {Array} + */ + _valuesArray: Array; + /** + * Represents the SQL Query template for the keys. + * @type {string} + */ + _keysTemplate: string; + /** + * The total number of fields. + * + * @type {number} + */ + totalFields: number; +} + +/** + * Interface IDbFactorizeInput represents the input required to factorize a SQL query. + */ +export interface IDbFactorizeInput { + /** + * An object containing values that will be in a SQL Query. + * + * @type {Array} + */ + values: object; + /** + * Represents the name of the action that will result of the prepared SQL Query. + * + * @type {string} + */ + actionName: string; + /** + * Indicates whether an error should be thrown when encountering an error. + * If set to true, an error will be thrown. If set to false or not provided, the error will not be thrown. + * + * @type {boolean} + */ + throwOnError?: true; +} \ No newline at end of file