@onzag/itemize / Modules / 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
- buildElasticQueryForModule
- buildSQLQueryForModule
- convertRQValueToSQLValueForModule
- convertSQLValueToElasticSQLValueForModule
- convertSQLValueToRQValueForModule
- getElasticSchemaForModule
- getSQLTableDefinitionForModule
- getSQLTablesSchemaForModule
▸ 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
| 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 |
- |
▸ 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
| 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 |
[string, any[]][]
▸ 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
| 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 |
ISQLStreamComposedTableRowValue
the composed row value with the consume streams function
▸ convertSQLValueToElasticSQLValueForModule(serverData, appData, mod, row): ISQLTableRowValue
| Name | Type |
|---|---|
serverData |
any |
appData |
IAppDataType |
mod |
default |
row |
ISQLTableRowValue |
▸ 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
| 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: {}} |
a rq value
▸ getElasticSchemaForModule(mod, serverData, appData): IElasticSchemaDefinitionType
| Name | Type |
|---|---|
mod |
default |
serverData |
any |
appData |
IAppDataType |
▸ getSQLTableDefinitionForModule(mod): ISQLTableDefinitionType
Provides the table that is necesary to include this module and all its children child definitions into it
| Name | Type | Description |
|---|---|---|
mod |
default |
the module in question |
a whole table schema for the module table
▸ getSQLTablesSchemaForModule(mod): ISQLSchemaDefinitionType
Provides the SQL table schemas that are contained within this module, you expect one schema per item definition it contains
| Name | Type | Description |
|---|---|---|
mod |
default |
the module in question |
a partial database schema for the module itself, all the child modules, and the item definition