Skip to content

Latest commit

 

History

History
245 lines (158 loc) · 10 KB

File metadata and controls

245 lines (158 loc) · 10 KB

@onzag/itemize / Modules / base/Root/Module/sql

Module: base/Root/Module/sql

This file contains the sql functionaly that is used within modules in order to perform queries within the module itself as well as to define the parent module table that is to be used in the item definition for properties in common

Table of contents

Functions

Functions

buildElasticQueryForModule

buildElasticQueryForModule(serverData, appData, mod, args, elasticQueryBuilder, language, dictionary, search, orderBy, fullHighlights): IElasticHighlightReply

Builds a sql query specific for this module to search within itself in the database

Parameters

Name Type Description
serverData any the server data
appData IAppDataType -
mod default the module in question
args IRQArgs the args for the query from rq
elasticQueryBuilder ElasticQueryBuilder the where builder
language string -
dictionary string the dictionary used
search string the search
orderBy IOrderByRuleType the order by rule
fullHighlights number -

Returns

IElasticHighlightReply

Defined in

base/Root/Module/sql.ts:499


buildSQLQueryForModule

buildSQLQueryForModule(serverData, appData, mod, args, whereBuilder, orderByBuilder, language, dictionary, search, orderBy): [string, any[]][]

Builds a sql query specific for this module to search within itself in the database

Parameters

Name Type Description
serverData any the server data
appData IAppDataType -
mod default the module in question
args IRQArgs the args for the query from rq
whereBuilder WhereBuilder the where builder
orderByBuilder OrderByBuilder the order by builder
language string -
dictionary string the dictionary used
search string the search
orderBy IOrderByRuleType the order by rule

Returns

[string, any[]][]

Defined in

base/Root/Module/sql.ts:389


convertRQValueToSQLValueForModule

convertRQValueToSQLValueForModule(serverData, appData, mod, data, oldData, uploadsClient, domain, language, dictionary, partialFields?): ISQLStreamComposedTableRowValue

Converts a rq value, with all its items and everything it has into a SQL row data value for this specific module

Parameters

Name Type Description
serverData any -
appData IAppDataType -
mod default the module in question
data IRQArgs the rq data
oldData IRQValue the old stored value for this module
uploadsClient default<any> the uploads client
domain string -
language string | ISQLTableRowValue -
dictionary string | ISQLTableRowValue the postgresql dictionary
partialFields? IRQArgs | IRQValue | IRQRequestFields fields to make a partial value rather than a total value, note that we don't recommend using partial fields in order to create because some properties might treat nulls in a fancy way, when creating all the table rows should be set, only when updating you should use partial fields; for example, if you have a field that has a property that is nullable but it's forced into some value it will be ignored in a partial field value, don't use partial fields to create

Returns

ISQLStreamComposedTableRowValue

the composed row value with the consume streams function

Defined in

base/Root/Module/sql.ts:247


convertSQLValueToElasticSQLValueForModule

convertSQLValueToElasticSQLValueForModule(serverData, appData, mod, row): ISQLTableRowValue

Parameters

Name Type
serverData any
appData IAppDataType
mod default
row ISQLTableRowValue

Returns

ISQLTableRowValue

Defined in

base/Root/Module/sql.ts:347


convertSQLValueToRQValueForModule

convertSQLValueToRQValueForModule(serverData, appData, mod, row, rqFields): IRQValue

Converts a SQL value directly coming from the database as it is to a rq value for this specific module, this only includes prop extensions and standard properties and excludes everything else

Parameters

Name Type Description
serverData any the server data information
appData IAppDataType -
mod default the module in question
row ISQLTableRowValue the row value, with all the columns it has; the row can be overblown with other field data, this will extract only the data required for this module
rqFields IRQRequestFields contains the only properties that are required in the request provided by grapql fields, eg {id: {}, name: {}}

Returns

IRQValue

a rq value

Defined in

base/Root/Module/sql.ts:315


getElasticSchemaForModule

getElasticSchemaForModule(mod, serverData, appData): IElasticSchemaDefinitionType

Parameters

Name Type
mod default
serverData any
appData IAppDataType

Returns

IElasticSchemaDefinitionType

Defined in

base/Root/Module/sql.ts:36


getSQLTableDefinitionForModule

getSQLTableDefinitionForModule(mod): ISQLTableDefinitionType

Provides the table that is necesary to include this module and all its children child definitions into it

Parameters

Name Type Description
mod default the module in question

Returns

ISQLTableDefinitionType

a whole table schema for the module table

Defined in

base/Root/Module/sql.ts:84


getSQLTablesSchemaForModule

getSQLTablesSchemaForModule(mod): ISQLSchemaDefinitionType

Provides the SQL table schemas that are contained within this module, you expect one schema per item definition it contains

Parameters

Name Type Description
mod default the module in question

Returns

ISQLSchemaDefinitionType

a partial database schema for the module itself, all the child modules, and the item definition

Defined in

base/Root/Module/sql.ts:208