@onzag/itemize / Modules / base/Root/Module/ItemDefinition/PropertyDefinition/sql
Contains SQL helper functions to be used within the property definition in order to be able to perform searches of them in the database
- buildElasticOrderByForInternalRequiredProperty
- buildElasticOrderByForProperty
- buildElasticQueryForProperty
- buildElasticStrSearchQueryForProperty
- buildSQLOrderByForInternalRequiredProperty
- buildSQLOrderByForProperty
- buildSQLQueryForProperty
- buildSQLStrSearchQueryForProperty
- convertRQValueToSQLValueForProperty
- convertSQLValueToElasticSQLValueForProperty
- convertSQLValueToRQValueForProperty
- getElasticSchemaForProperty
- getSQLTableDefinitionForProperty
- getStandardElasticFor
- getStandardElasticForWithNullField
- getStandardSQLFnFor
- standardElasticOrderBy
- standardElasticSearchFnExactAndRange
- standardElasticSearchFnWithNullFieldExactAndRange
- standardSQLBtreeIndexable
- standardSQLElasticInFn
- standardSQLEqualFn
- standardSQLInFn
- standardSQLOrderBy
- standardSQLOutFn
- standardSQLOutWithJSONParseFn
- standardSQLSearchFnExactAndRange
- standardSQLSelect
- stardardSQLInWithJSONStringifyFn
▸ buildElasticOrderByForInternalRequiredProperty(itemDefinition, which, args, direction, nulls): Object
Builds the order by functionality for the internal properties, such as created_at, edited_at, etc...
| Name | Type | Description |
|---|---|---|
itemDefinition |
default |
the item definition |
which |
string |
basically the column name |
args |
IRQArgs |
- |
direction |
"asc" | "desc" |
the direction of the order by rule |
nulls |
"first" | "last" |
whether nulls are first or last |
Object
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:1091
▸ buildElasticOrderByForProperty(serverData, appData, itemDefinition, include, propertyDefinition, args, direction, nulls, wasIncludedInSearch, wasIncludedInStrSearch): any
Builds an order by query for a given property
| Name | Type | Description |
|---|---|---|
serverData |
any |
the server data that is being used |
appData |
IAppDataType |
- |
itemDefinition |
default |
the item definition in question |
include |
default |
the include (or null) |
propertyDefinition |
default |
the property in question |
args |
IRQArgs |
- |
direction |
"asc" | "desc" |
the direction to be accounted for |
nulls |
"first" | "last" |
the nulls (first or last) |
wasIncludedInSearch |
boolean |
whether this property was included in search |
wasIncludedInStrSearch |
boolean |
whether this property was included in the str FTS search |
any
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:1002
▸ buildElasticQueryForProperty(serverData, appData, itemDefinition, include, propertyDefinition, args, elasticQueryBuilder, language, dictionary, isOrderedByIt, fullHighlights): IElasticHighlightReply
Builds a sql search query from a given property definition, the data coming from the search module, a sql prefix to use
| Name | Type | Description |
|---|---|---|
serverData |
any |
the server data |
appData |
IAppDataType |
- |
itemDefinition |
default |
the item definition that contains the property |
include |
default |
the include within the item definition, or null |
propertyDefinition |
default |
the property definition in question |
args |
IRQArgs |
the args coming from the search module in such format |
elasticQueryBuilder |
ElasticQueryBuilder |
the elastic building instance |
language |
string |
- |
dictionary |
string |
the dictionary that is being used |
isOrderedByIt |
boolean |
whether there will be a subsequent order by request |
fullHighlights |
number |
- |
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:792
▸ buildElasticStrSearchQueryForProperty(serverData, appData, itemDefinition, include, propertyDefinition, args, search, elasticQueryBuilder, language, dictionary, isOrderedByIt, fullHighlights): IElasticHighlightReply
Builds a sql str FTS search query from a given property definition, the data coming from the search module, a sql prefix to use, and the builder
| Name | Type | Description |
|---|---|---|
serverData |
any |
the server data |
appData |
IAppDataType |
- |
itemDefinition |
default |
the item definition that contains the property |
include |
default |
the include within the item definition, or null |
propertyDefinition |
default |
the property definition in question |
args |
IRQArgs |
the args coming from the search module in such format |
search |
string |
the search string that is being used |
elasticQueryBuilder |
ElasticQueryBuilder |
the building instance |
language |
string |
- |
dictionary |
string |
the dictionary that is being used |
isOrderedByIt |
boolean |
whether there will be a subsequent order by request |
fullHighlights |
number |
- |
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:886
▸ buildSQLOrderByForInternalRequiredProperty(itemDefinition, which, args, orderByBuilder, direction, nulls): void
Builds the order by functionality for the internal properties, such as created_at, edited_at, etc...
| Name | Type | Description |
|---|---|---|
itemDefinition |
default |
the item definition |
which |
string |
basically the column name |
args |
IRQArgs |
- |
orderByBuilder |
OrderByBuilder |
the order by builder |
direction |
"asc" | "desc" |
the direction of the order by rule |
nulls |
"first" | "last" |
whether nulls are first or last |
void
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:1049
▸ buildSQLOrderByForProperty(serverData, appData, itemDefinition, include, propertyDefinition, args, orderByBuilder, direction, nulls, wasIncludedInSearch, wasIncludedInStrSearch): void
Builds an order by query for a given property
| Name | Type | Description |
|---|---|---|
serverData |
any |
the server data that is being used |
appData |
IAppDataType |
- |
itemDefinition |
default |
the item definition in question |
include |
default |
the include (or null) |
propertyDefinition |
default |
the property in question |
args |
IRQArgs |
- |
orderByBuilder |
OrderByBuilder |
the order by builder that is currently building the query |
direction |
"asc" | "desc" |
the direction to be accounted for |
nulls |
"first" | "last" |
the nulls (first or last) |
wasIncludedInSearch |
boolean |
whether this property was included in search |
wasIncludedInStrSearch |
boolean |
whether this property was included in the str FTS search |
void
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:947
▸ buildSQLQueryForProperty(serverData, appData, itemDefinition, include, propertyDefinition, args, whereBuilder, language, dictionary, isOrderedByIt): boolean | [string, any[]]
Builds a sql search query from a given property definition, the data coming from the search module, a sql prefix to use
| Name | Type | Description |
|---|---|---|
serverData |
any |
the server data |
appData |
IAppDataType |
- |
itemDefinition |
default |
the item definition that contains the property |
include |
default |
the include within the item definition, or null |
propertyDefinition |
default |
the property definition in question |
args |
IRQArgs |
the args coming from the search module in such format |
whereBuilder |
WhereBuilder |
the where building instance |
language |
string |
- |
dictionary |
string |
the dictionary that is being used |
isOrderedByIt |
boolean |
whether there will be a subsequent order by request |
boolean | [string, any[]]
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:752
▸ buildSQLStrSearchQueryForProperty(serverData, appData, itemDefinition, include, propertyDefinition, args, search, whereBuilder, language, dictionary, isOrderedByIt): boolean | [string, any[]]
Builds a sql str FTS search query from a given property definition, the data coming from the search module, a sql prefix to use, and the builder
| Name | Type | Description |
|---|---|---|
serverData |
any |
the server data |
appData |
IAppDataType |
- |
itemDefinition |
default |
the item definition that contains the property |
include |
default |
the include within the item definition, or null |
propertyDefinition |
default |
the property definition in question |
args |
IRQArgs |
the args coming from the search module in such format |
search |
string |
the search string that is being used |
whereBuilder |
WhereBuilder |
the where building instance |
language |
string |
- |
dictionary |
string |
the dictionary that is being used |
isOrderedByIt |
boolean |
whether there will be a subsequent order by request |
boolean | [string, any[]]
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:840
▸ convertRQValueToSQLValueForProperty(serverData, appData, mod, itemDefinition, include, propertyDefinition, data, oldData, uploadsClient, domain, language, dictionary): ISQLStreamComposedTableRowValue
Converts a rq value into a sql value, that is rq data into row data to be immediately added to the database as it is
| Name | Type | Description |
|---|---|---|
serverData |
any |
the server data |
appData |
IAppDataType |
- |
mod |
default |
the module |
itemDefinition |
default |
the item definition that contains the property |
include |
default |
the include within the item definition, or null |
propertyDefinition |
default |
the property definition in question |
data |
IRQArgs |
the rq data |
oldData |
IRQValue |
the old rq data |
uploadsClient |
default<any> |
- |
domain |
string |
- |
language |
string | ISQLTableRowValue |
- |
dictionary |
string | ISQLTableRowValue |
the dictionary to use in full text search mode |
ISQLStreamComposedTableRowValue
a composed value with a partial row value and the consume streams functionality included in it
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:650
▸ convertSQLValueToElasticSQLValueForProperty(serverData, appData, itemDefinition, include, propertyDefinition, row): IRQValue
| Name | Type |
|---|---|
serverData |
any |
appData |
IAppDataType |
itemDefinition |
default |
include |
default |
propertyDefinition |
default |
row |
ISQLTableRowValue |
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:612
▸ convertSQLValueToRQValueForProperty(serverData, appData, itemDefinition, include, propertyDefinition, row): IRQValue
Takes row data information that is in the SQL form and converts it into a rq form, only for this specific property
| Name | Type | Description |
|---|---|---|
serverData |
any |
the server data |
appData |
IAppDataType |
- |
itemDefinition |
default |
the item definition that contains the property |
include |
default |
the include within the item definition, or null |
propertyDefinition |
default |
the property definition in question |
row |
ISQLTableRowValue |
the row that we want to extract information from |
the rq value for the property
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:551
▸ getElasticSchemaForProperty(itemDefinition, include, propertyDefinition, serverData, appData): IElasticIndexDefinitionType
| Name | Type |
|---|---|
itemDefinition |
default |
include |
default |
propertyDefinition |
default |
serverData |
any |
appData |
IAppDataType |
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:516
▸ getSQLTableDefinitionForProperty(itemDefinition, include, propertyDefinition): ISQLTableDefinitionType
Provides the table bit that is necessary to include this property and this property alone, that is a table bit
| Name | Type | Description |
|---|---|---|
itemDefinition |
default |
the item definition that contains the property |
include |
default |
the include within the item definition, or null |
propertyDefinition |
default |
the property definition in question |
the partial sql table definition for the property
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:496
▸ getStandardElasticFor(type, nullValue, format?, disabled?): (arg: IArgInfo) => IElasticIndexDefinitionType
| Name | Type |
|---|---|
type |
string |
nullValue |
any |
format? |
string |
disabled? |
boolean |
fn
▸ (arg): IElasticIndexDefinitionType
| Name | Type |
|---|---|
arg |
IArgInfo |
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:66
▸ getStandardElasticForWithNullField(type, format?, disabled?): (arg: IArgInfo) => IElasticIndexDefinitionType
| Name | Type |
|---|---|
type |
string |
format? |
string |
disabled? |
boolean |
fn
▸ (arg): IElasticIndexDefinitionType
| Name | Type |
|---|---|
arg |
IArgInfo |
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:97
▸ getStandardSQLFnFor(type, ext?, indexCalculator?): (arg: ISQLArgInfo) => ISQLTableDefinitionType
Provides the sql function that defines the schema that is used to build the partial table definition
| Name | Type | Default value | Description |
|---|---|---|---|
type |
string |
undefined |
the postgresql type |
ext |
string |
null |
a extension to require for this type |
indexCalculator? |
(subtype: string, sqlPrefix: string, id: string) => ISQLTableIndexType |
undefined |
an function to decide how to build an index for this type |
fn
a function that returns the partial table definition object with the given type
▸ (arg): ISQLTableDefinitionType
| Name | Type |
|---|---|
arg |
ISQLArgInfo |
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:38
▸ standardElasticOrderBy(arg): Object
| Name | Type |
|---|---|
arg |
ISQLOrderByInfo |
Object
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:133
▸ standardElasticSearchFnExactAndRange(nullFieldValue, arg): Object
You must ensure no overlap in ranged search, if they are availbe in order for this function to be useful, it will not pluck them out
| Name | Type |
|---|---|
nullFieldValue |
string |
arg |
IElasticSearchInfo |
Object
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:448
▸ standardElasticSearchFnWithNullFieldExactAndRange(arg): Object
| Name | Type |
|---|---|
arg |
IElasticSearchInfo |
Object
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:452
▸ standardSQLBtreeIndexable(arg): string[]
The standard btree indexable column builder
| Name | Type | Description |
|---|---|---|
arg |
ISQLBtreeIndexableInfo |
the sql btree indexable arg |
string[]
an array of the columns to index
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:484
▸ standardSQLElasticInFn(arg): any
The standard sql elastic out that converts to the elastic stored form
| Name | Type | Description |
|---|---|---|
arg |
ISQLOutInfo |
the out arg info |
any
the property value out
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:265
▸ standardSQLEqualFn(arg): void
The standard function that perfoms equality checks within the database
| Name | Type | Description |
|---|---|---|
arg |
ISQLEqualInfo |
the equal info arg |
void
a valid args to use in the where expression or an object for where many
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:462
▸ standardSQLInFn(arg): ISQLTableRowValue
The standard sql in function that specifies how a property inputs its value into a table
| Name | Type | Description |
|---|---|---|
arg |
ISQLInInfo |
the in arg |
the partial row value
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:163
▸ standardSQLOrderBy(arg): [string, string, string]
the standard order by functionality
| Name | Type | Description |
|---|---|---|
arg |
ISQLOrderByInfo |
the orer by info arg |
[string, string, string]
an array of string with the order by
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:129
▸ standardSQLOutFn(fallbackNull, arg): any
The standard sql out function that defines how a value for a property is extracted from a given row
| Name | Type | Description |
|---|---|---|
fallbackNull |
any |
- |
arg |
ISQLOutInfo |
the out arg info |
any
the property value out
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:224
▸ standardSQLOutWithJSONParseFn(fallbackNull, arg): any
The standard sql out function that deserializes values as they are expected to be stored serialized
| Name | Type | Description |
|---|---|---|
fallbackNull |
any |
- |
arg |
ISQLOutInfo |
the sql out info arg |
any
the supported type json parsed
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:277
▸ standardSQLSearchFnExactAndRange(arg): boolean
The standard function that build queries for the property
| Name | Type | Description |
|---|---|---|
arg |
ISQLSearchInfo |
the search info arg |
boolean
a boolean on whether it was searched by it
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:308
▸ standardSQLSelect(arg): string[]
The standard sql select function that is used to select the minimum necessary for a selection in a traditional search
| Name | Type | Description |
|---|---|---|
arg |
IArgInfo |
the in arg |
string[]
the rows to select
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:145
▸ stardardSQLInWithJSONStringifyFn(arg): ISQLTableRowValue
The standard sql in function that inputs its value but uses JSON stringify as a serialization tool
| Name | Type | Description |
|---|---|---|
arg |
ISQLInInfo |
the in arg |
the partial row value
base/Root/Module/ItemDefinition/PropertyDefinition/sql/index.ts:203