@onzag/itemize / Modules / base/Root/Module/ItemDefinition/sql
This file specifies all the sql executions functions that are used in order to query item definitions from the postgresql database, refer to this file once you need to figure out how resources are requested
- buildElasticQueryForItemDefinition
- buildSQLQueryForItemDefinition
- convertRQValueToSQLValueForItemDefinition
- convertSQLValueToElasticSQLValueForItemDefinition
- convertSQLValueToRQValueForItemDefinition
- getElasticSchemaForItemDefinition
- getSQLTableDefinitionForItemDefinition
- getSQLTablesSchemaForItemDefinition
▸ buildElasticQueryForItemDefinition(serverData, appData, itemDefinition, args, elasticQueryBuilder, language, dictionary, search, orderBy, fullHighlights): IElasticHighlightReply
Builds a elastic query for an item definition so that it can be queried for searches
| Name | Type | Description |
|---|---|---|
serverData |
any |
the server data |
appData |
IAppDataType |
- |
itemDefinition |
default |
the item definition that is being requested (normal form) |
args |
IRQArgs |
the args from the search mode |
elasticQueryBuilder |
ElasticQueryBuilder |
the where builder instance |
language |
string |
- |
dictionary |
string |
the dictionary being used |
search |
string |
the search arg value |
orderBy |
IOrderByRuleType |
the order by rules |
fullHighlights |
number |
- |
a list of raw added selected fields
base/Root/Module/ItemDefinition/sql.ts:628
▸ buildSQLQueryForItemDefinition(serverData, appData, itemDefinition, args, whereBuilder, orderByBuilder, language, dictionary, search, orderBy): [string, any[]][]
Builds a sql query for an item definition so that it can be queried for searches
| Name | Type | Description |
|---|---|---|
serverData |
any |
the server data |
appData |
IAppDataType |
- |
itemDefinition |
default |
the item definition that is being requested (normal form) |
args |
IRQArgs |
the args from the search mode |
whereBuilder |
WhereBuilder |
the where builder instance |
orderByBuilder |
OrderByBuilder |
the order by builder instance |
language |
string |
- |
dictionary |
string |
the dictionary being used |
search |
string |
the search arg value |
orderBy |
IOrderByRuleType |
the order by rules |
[string, any[]][]
a list of raw added selected fields
base/Root/Module/ItemDefinition/sql.ts:475
▸ convertRQValueToSQLValueForItemDefinition(serverData, appData, itemDefinition, 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 item definition it doesn't include its prop extensions
| Name | Type | Description |
|---|---|---|
serverData |
any |
the server data |
appData |
IAppDataType |
- |
itemDefinition |
default |
the item definition in question |
data |
IRQArgs |
the rq data |
oldData |
IRQValue |
- |
uploadsClient |
default<any> |
- |
domain |
string |
- |
language |
string | ISQLTableRowValue |
- |
dictionary |
string | ISQLTableRowValue |
the dictionary to use in full text search mode |
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
a sql value
base/Root/Module/ItemDefinition/sql.ts:378
▸ convertSQLValueToElasticSQLValueForItemDefinition(serverData, appData, itemDefinition, row): IRQValue
| Name | Type |
|---|---|
serverData |
any |
appData |
IAppDataType |
itemDefinition |
default |
row |
ISQLTableRowValue |
base/Root/Module/ItemDefinition/sql.ts:315
▸ convertSQLValueToRQValueForItemDefinition(serverData, appData, itemDefinition, row, rqFields?): IRQValue
Converts a SQL value directly coming from the database as it is to a rq value for this specific item definition, this includes the prop extensions and the reserved base properties This value is FLATTENED
| Name | Type | Description |
|---|---|---|
serverData |
any |
the server data we are working with |
appData |
IAppDataType |
- |
itemDefinition |
default |
the item definition 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 item definition |
rqFields? |
IRQRequestFields |
contains the only properties that are required in the request provided by grapql fields, eg {id: {}, name: {}, ITEM_kitten: {purrs: {}}} |
a rq value
base/Root/Module/ItemDefinition/sql.ts:260
▸ getElasticSchemaForItemDefinition(itemDefinition, moduleIndexSchema, serverData, appData): IElasticSchemaDefinitionType
| Name | Type |
|---|---|
itemDefinition |
default |
moduleIndexSchema |
IElasticIndexDefinitionType |
serverData |
any |
appData |
IAppDataType |
base/Root/Module/ItemDefinition/sql.ts:50
▸ getSQLTableDefinitionForItemDefinition(itemDefinition): ISQLTableDefinitionType
Provides the table that is necesary to include this item definition as a whole that is, this represents a whole table, that is necessary for this item to be saved when populated, it basically adds up all the table bits from all the properties and all the items, this does not include prop extensions nor module level properties, nor base
| Name | Type | Description |
|---|---|---|
itemDefinition |
default |
the item definition in question |
a complete table definition type
base/Root/Module/ItemDefinition/sql.ts:107
▸ getSQLTablesSchemaForItemDefinition(itemDefinition): ISQLSchemaDefinitionType
Provides all the schema of all the items, self and its children that are included within this item definition and all the table names that should be used using the qualified name
| Name | Type | Description |
|---|---|---|
itemDefinition |
default |
the item definition in question |
a partial sql schema definition for the whole database (adds tables)