@sourceloop/search-service / Exports / MySqlQueryBuilder
Class: MySqlQueryBuilder<T>¶
Type parameters¶
Name | Type |
---|---|
T |
extends Model |
Hierarchy¶
-
↳
MySqlQueryBuilder
Table of contents¶
Constructors¶
Properties¶
Accessors¶
Methods¶
- build
- buildClauseFromExpress
- buildColumnValueForExpression
- buildExpression
- getColumnListFromArray
- getColumnListFromArrayOrMap
- getColumnListFromMap
- getColumnName
- getModelName
- getSchemaName
- getTableName
- handleAndOr
- handleKeys
- handleObjectValue
- limit
- order
- paramString
- paramsBuild
- parseIdPlaceholder
- queryBuild
- search
- toArrayPropTypes
- toColumnValue
- toDateType
- whereBuild
Constructors¶
constructor¶
• new MySqlQueryBuilder<T
>(query
)
Type parameters¶
Name | Type |
---|---|
T |
extends Model <T > |
Parameters¶
Name | Type |
---|---|
query |
DataObject <SearchQuery > |
Overrides¶
SearchQueryBuilder.constructor
Defined in¶
services/search-service/src/classes/mysql/query.builder.ts:14
Properties¶
_placeholderIndex¶
• _placeholderIndex: number
= 0
Overrides¶
SearchQueryBuilder._placeholderIndex
Defined in¶
services/search-service/src/classes/mysql/query.builder.ts:12
baseQueryList¶
• Protected
baseQueryList: Query
[]
Inherited from¶
SearchQueryBuilder.baseQueryList
Defined in¶
services/search-service/src/classes/base/query.builder.ts:29
idType¶
• Protected
Optional
idType: string
= 'uuid'
Inherited from¶
Defined in¶
services/search-service/src/classes/base/query.builder.ts:34
limitQuery¶
• Protected
limitQuery: string
Inherited from¶
Defined in¶
services/search-service/src/classes/base/query.builder.ts:30
modelNameMap¶
• Protected
modelNameMap: Map
<string
, string
>
Inherited from¶
SearchQueryBuilder.modelNameMap
Defined in¶
services/search-service/src/classes/base/query.builder.ts:36
orderQuery¶
• Protected
orderQuery: string
Inherited from¶
Defined in¶
services/search-service/src/classes/base/query.builder.ts:31
query¶
• Protected
query: DataObject
<SearchQuery
>
Inherited from¶
Defined in¶
services/search-service/src/classes/base/query.builder.ts:32
schema¶
• Protected
Optional
schema: string
Inherited from¶
Defined in¶
services/search-service/src/classes/base/query.builder.ts:33
unionString¶
• unionString: string
= ' UNION ALL '
Overrides¶
SearchQueryBuilder.unionString
Defined in¶
services/search-service/src/classes/mysql/query.builder.ts:11
Accessors¶
placeholder¶
• Protected
get
placeholder(): string
Returns¶
string
Inherited from¶
SearchQueryBuilder.placeholder
Defined in¶
services/search-service/src/classes/base/query.builder.ts:37
• Protected
set
placeholder(val
): void
Parameters¶
Name | Type |
---|---|
val |
string | number |
Returns¶
void
Inherited from¶
SearchQueryBuilder.placeholder
Defined in¶
services/search-service/src/classes/base/query.builder.ts:41
Methods¶
build¶
▸ build(models
, ignoredColumns?
, type?
, idType?
): Object
Parameters¶
Name | Type |
---|---|
models |
(typeof Model | SearchableModel <T , typeof Model >)[] |
ignoredColumns? |
Exclude <keyof T , "getId" | "getIdObject" | "toJSON" | "toObject" >[] |
type? |
typeof Model |
idType? |
string |
Returns¶
Object
Name | Type |
---|---|
params |
AnyObject | (string | AnyObject )[] |
query |
string |
Inherited from¶
Defined in¶
services/search-service/src/classes/base/query.builder.ts:58
buildClauseFromExpress¶
▸ buildClauseFromExpress(values
, separator
, grouping
, getPlaceholder
): Query
Parameters¶
Name | Type |
---|---|
values |
ShortHandEqualType | Query | (ShortHandEqualType | Query )[] |
separator |
string |
grouping |
boolean |
getPlaceholder |
() => string |
Returns¶
Inherited from¶
SearchQueryBuilder.buildClauseFromExpress
Defined in¶
services/search-service/src/classes/base/query.builder.ts:527
buildColumnValueForExpression¶
▸ buildColumnValueForExpression(expressionValue
, p
): any
[]
Parameters¶
Name | Type |
---|---|
expressionValue |
PredicateValueType <ShortHandEqualType > |
p |
PropertyDefinition |
Returns¶
any
[]
Inherited from¶
SearchQueryBuilder.buildColumnValueForExpression
Defined in¶
services/search-service/src/classes/base/query.builder.ts:368
buildExpression¶
▸ buildExpression(columnName
, prop
, operator
, value
, model
): Object
Parameters¶
Name | Type |
---|---|
columnName |
keyof T |
prop |
PropertyDefinition |
operator |
string |
value |
ShortHandEqualType | Query | (ShortHandEqualType | Query )[] |
model |
typeof Model |
Returns¶
Object
Name | Type |
---|---|
params |
ShortHandEqualType [] |
sql |
string |
Inherited from¶
SearchQueryBuilder.buildExpression
Defined in¶
services/search-service/src/classes/base/query.builder.ts:463
getColumnListFromArray¶
▸ getColumnListFromArray(model
, columns
, filter
): Object
Parameters¶
Name | Type |
---|---|
model |
typeof Model |
columns |
keyof T [] |
filter |
keyof T [] |
Returns¶
Object
Name | Type |
---|---|
columnList |
string |
selectors |
string |
Inherited from¶
SearchQueryBuilder.getColumnListFromArray
Defined in¶
services/search-service/src/classes/base/query.builder.ts:179
getColumnListFromArrayOrMap¶
▸ getColumnListFromArrayOrMap(model
, columns
, filter
): Object
Parameters¶
Name | Type |
---|---|
model |
typeof Model |
columns |
keyof T [] | ColumnMap <T > |
filter |
keyof T [] |
Returns¶
Object
Name | Type |
---|---|
columnList |
string |
selectors |
string |
Inherited from¶
SearchQueryBuilder.getColumnListFromArrayOrMap
Defined in¶
services/search-service/src/classes/base/query.builder.ts:132
getColumnListFromMap¶
▸ getColumnListFromMap(model
, columns
, filter
): Object
Parameters¶
Name | Type |
---|---|
model |
typeof Model |
columns |
ColumnMap <T > |
filter |
keyof T [] |
Returns¶
Object
Name | Type |
---|---|
columnList |
string |
selectors |
string |
Inherited from¶
SearchQueryBuilder.getColumnListFromMap
Defined in¶
services/search-service/src/classes/base/query.builder.ts:144
getColumnName¶
▸ getColumnName(model
, name
): any
Parameters¶
Name | Type |
---|---|
model |
typeof Model |
name |
keyof T |
Returns¶
any
Inherited from¶
SearchQueryBuilder.getColumnName
Defined in¶
services/search-service/src/classes/base/query.builder.ts:391
getModelName¶
▸ getModelName(model
): any
Parameters¶
Name | Type |
---|---|
model |
typeof Model |
Returns¶
any
Overrides¶
SearchQueryBuilder.getModelName
Defined in¶
services/search-service/src/classes/mysql/query.builder.ts:49
getSchemaName¶
▸ getSchemaName(model
): string
Parameters¶
Name | Type |
---|---|
model |
typeof Model |
Returns¶
string
Inherited from¶
SearchQueryBuilder.getSchemaName
Defined in¶
services/search-service/src/classes/base/query.builder.ts:567
getTableName¶
▸ getTableName(model
): string
Parameters¶
Name | Type |
---|---|
model |
typeof Model |
Returns¶
string
Inherited from¶
SearchQueryBuilder.getTableName
Defined in¶
services/search-service/src/classes/base/query.builder.ts:563
handleAndOr¶
▸ handleAndOr<S
>(where
, key
, model
): undefined
| Query
Type parameters¶
Name | Type |
---|---|
S |
extends typeof Model |
Parameters¶
Name | Type |
---|---|
where |
SearchWhereFilter <AnyObject > |
key |
never |
model |
S |
Returns¶
undefined
| Query
Inherited from¶
SearchQueryBuilder.handleAndOr
Defined in¶
services/search-service/src/classes/base/query.builder.ts:312
handleKeys¶
▸ handleKeys(model
, key
, where
): undefined
| Query
| Queries
Parameters¶
Name | Type |
---|---|
model |
typeof Model |
key |
never |
where |
SearchWhereFilter <AnyObject > |
Returns¶
Inherited from¶
Defined in¶
services/search-service/src/classes/base/query.builder.ts:269
handleObjectValue¶
▸ handleObjectValue<S
>(expression
, p
, key
, model
): undefined
| Query
Type parameters¶
Name | Type |
---|---|
S |
extends typeof Model |
Parameters¶
Name | Type |
---|---|
expression |
PredicateComparison <ShortHandEqualType > |
p |
PropertyDefinition |
key |
never |
model |
S |
Returns¶
undefined
| Query
Inherited from¶
SearchQueryBuilder.handleObjectValue
Defined in¶
services/search-service/src/classes/base/query.builder.ts:343
limit¶
▸ limit(): void
Returns¶
void
Inherited from¶
Defined in¶
services/search-service/src/classes/base/query.builder.ts:77
order¶
▸ order(columns
): void
Parameters¶
Name | Type |
---|---|
columns |
keyof T [] |
Returns¶
void
Inherited from¶
Defined in¶
services/search-service/src/classes/base/query.builder.ts:102
paramString¶
▸ paramString(index
): string
Parameters¶
Name | Type |
---|---|
index |
number |
Returns¶
string
Overrides¶
SearchQueryBuilder.paramString
Defined in¶
services/search-service/src/classes/mysql/query.builder.ts:45
paramsBuild¶
▸ paramsBuild(param
): AnyObject
| (string
| AnyObject
)[]
Parameters¶
Name | Type |
---|---|
param |
string |
Returns¶
AnyObject
| (string
| AnyObject
)[]
Inherited from¶
SearchQueryBuilder.paramsBuild
Defined in¶
services/search-service/src/classes/base/query.builder.ts:200
parseIdPlaceholder¶
▸ parseIdPlaceholder(prop
): string
Parameters¶
Name | Type |
---|---|
prop |
PropertyDefinition |
Returns¶
string
Inherited from¶
SearchQueryBuilder.parseIdPlaceholder
Defined in¶
services/search-service/src/classes/base/query.builder.ts:383
queryBuild¶
▸ queryBuild(models
, ignoredColumns?
, type?
): string
Parameters¶
Name | Type |
---|---|
models |
(typeof Model | SearchableModel <T , typeof Model >)[] |
ignoredColumns? |
keyof T [] |
type? |
typeof Model |
Returns¶
string
Inherited from¶
Defined in¶
services/search-service/src/classes/base/query.builder.ts:212
search¶
▸ search(model
, columns
, ignoredColumns
): void
Parameters¶
Name | Type |
---|---|
model |
typeof Model |
columns |
keyof T [] | ColumnMap <T > |
ignoredColumns |
keyof T [] |
Returns¶
void
Overrides¶
Defined in¶
services/search-service/src/classes/mysql/query.builder.ts:18
toArrayPropTypes¶
▸ toArrayPropTypes<R
>(prop
, val
): any
Type parameters¶
Name |
---|
R |
Parameters¶
Name | Type |
---|---|
prop |
PropertyDefinition |
val |
R | R [] |
Returns¶
any
Inherited from¶
SearchQueryBuilder.toArrayPropTypes
Defined in¶
services/search-service/src/classes/base/query.builder.ts:447
toColumnValue¶
▸ toColumnValue(prop
, val
): any
Parameters¶
Name | Type |
---|---|
prop |
PropertyDefinition |
val |
PredicateValueType <ShortHandEqualType > |
Returns¶
any
Inherited from¶
SearchQueryBuilder.toColumnValue
Defined in¶
services/search-service/src/classes/base/query.builder.ts:398
toDateType¶
▸ toDateType(val
): Object
Parameters¶
Name | Type |
---|---|
val |
string | Date |
Returns¶
Object
Name | Type |
---|---|
params |
string [] |
sql |
string |
Inherited from¶
Defined in¶
services/search-service/src/classes/base/query.builder.ts:434
whereBuild¶
▸ whereBuild<S
>(model
, where?
): Object
Type parameters¶
Name | Type |
---|---|
S |
extends typeof Model |
Parameters¶
Name | Type |
---|---|
model |
S |
where? |
SearchWhereFilter <AnyObject > |
Returns¶
Object
Name | Type |
---|---|
params |
ShortHandEqualType [] |
sql |
string |
Inherited from¶
Defined in¶
services/search-service/src/classes/base/query.builder.ts:255