Skip to content

Latest commit

 

History

History
254 lines (165 loc) · 11.5 KB

File metadata and controls

254 lines (165 loc) · 11.5 KB

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

Module: 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

Table of contents

Functions

Functions

buildElasticQueryForItemDefinition

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

Parameters

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 -

Returns

IElasticHighlightReply

a list of raw added selected fields

Defined in

base/Root/Module/ItemDefinition/sql.ts:628


buildSQLQueryForItemDefinition

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

Parameters

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

Returns

[string, any[]][]

a list of raw added selected fields

Defined in

base/Root/Module/ItemDefinition/sql.ts:475


convertRQValueToSQLValueForItemDefinition

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

Parameters

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

Returns

ISQLStreamComposedTableRowValue

a sql value

Defined in

base/Root/Module/ItemDefinition/sql.ts:378


convertSQLValueToElasticSQLValueForItemDefinition

convertSQLValueToElasticSQLValueForItemDefinition(serverData, appData, itemDefinition, row): IRQValue

Parameters

Name Type
serverData any
appData IAppDataType
itemDefinition default
row ISQLTableRowValue

Returns

IRQValue

Defined in

base/Root/Module/ItemDefinition/sql.ts:315


convertSQLValueToRQValueForItemDefinition

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

Parameters

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: {}}}

Returns

IRQValue

a rq value

Defined in

base/Root/Module/ItemDefinition/sql.ts:260


getElasticSchemaForItemDefinition

getElasticSchemaForItemDefinition(itemDefinition, moduleIndexSchema, serverData, appData): IElasticSchemaDefinitionType

Parameters

Name Type
itemDefinition default
moduleIndexSchema IElasticIndexDefinitionType
serverData any
appData IAppDataType

Returns

IElasticSchemaDefinitionType

Defined in

base/Root/Module/ItemDefinition/sql.ts:50


getSQLTableDefinitionForItemDefinition

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

Parameters

Name Type Description
itemDefinition default the item definition in question

Returns

ISQLTableDefinitionType

a complete table definition type

Defined in

base/Root/Module/ItemDefinition/sql.ts:107


getSQLTablesSchemaForItemDefinition

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

Parameters

Name Type Description
itemDefinition default the item definition in question

Returns

ISQLSchemaDefinitionType

a partial sql schema definition for the whole database (adds tables)

Defined in

base/Root/Module/ItemDefinition/sql.ts:229