KnexDBDataProvider
Knex.js database data provider exposing basic CRUD operations that works with all databases that knex supports. Layer is tested with following databases:
- SQLite (by
SQLiteKnexDBDataProvider
) - MySQL (MariaDB)
- Postgres
NOTE: For SQLite use dedicated SQLiteKnexDBDataProvider
that implements more speficic creation method to avoid the not supported returning()
statement.
#
Type parameters▪ Type
#
HierarchyKnexDBDataProvider
#
Implements- GraphbackDataProvider‹Type›
#
Index#
Constructors#
Properties#
Methods#
Constructors#
constructor+ new KnexDBDataProvider(baseType
: GraphQLObjectType, db
: Knex): KnexDBDataProvider
Defined in KnexDBDataProvider.ts:22
Parameters:
Name | Type |
---|---|
baseType | GraphQLObjectType |
db | Knex |
Returns: KnexDBDataProvider
#
PropertiesProtected
baseType#
• baseType: GraphQLObjectType
Defined in KnexDBDataProvider.ts:20
Protected
db#
• db: Knex
Defined in KnexDBDataProvider.ts:19
Protected
tableMap#
• tableMap: ModelTableMap
Defined in KnexDBDataProvider.ts:22
Protected
tableName#
• tableName: string
Defined in KnexDBDataProvider.ts:21
#
Methods#
batchRead▸ batchRead(relationField
: string, ids
: string[], filter
: any, context
: GraphbackContext): Promise‹Type[][]›
Defined in KnexDBDataProvider.ts:104
Parameters:
Name | Type |
---|---|
relationField | string |
ids | string[] |
filter | any |
context | GraphbackContext |
Returns: Promise‹Type[][]›
#
count▸ count(filter
: any): Promise‹number›
Defined in KnexDBDataProvider.ts:97
Parameters:
Name | Type |
---|---|
filter | any |
Returns: Promise‹number›
#
create▸ create(data
: Type, context
: GraphbackContext): Promise‹Type›
Defined in KnexDBDataProvider.ts:31
Parameters:
Name | Type |
---|---|
data | Type |
context | GraphbackContext |
Returns: Promise‹Type›
#
delete▸ delete(data
: Type, context
: GraphbackContext): Promise‹Type›
Defined in KnexDBDataProvider.ts:57
Parameters:
Name | Type |
---|---|
data | Type |
context | GraphbackContext |
Returns: Promise‹Type›
#
findBy▸ findBy(filter
: QueryFilter‹Type›, context
: GraphbackContext, page?
: GraphbackPage, orderBy?
: GraphbackOrderBy): Promise‹Type[]›
Defined in KnexDBDataProvider.ts:81
Parameters:
Name | Type |
---|---|
filter | QueryFilter‹Type› |
context | GraphbackContext |
page? | GraphbackPage |
orderBy? | GraphbackOrderBy |
Returns: Promise‹Type[]›
#
findOne▸ findOne(args
: Partial‹Type›, context
: GraphbackContext): Promise‹Type›
Defined in KnexDBDataProvider.ts:70
Parameters:
Name | Type |
---|---|
args | Partial‹Type› |
context | GraphbackContext |
Returns: Promise‹Type›
Protected
getSelectedFields#
▸ getSelectedFields(context
: GraphbackContext): string[] | ""*
Defined in KnexDBDataProvider.ts:121
Parameters:
Name | Type |
---|---|
context | GraphbackContext |
Returns: string[] | ""*
#
update▸ update(data
: Type, context
: GraphbackContext): Promise‹Type›
Defined in KnexDBDataProvider.ts:41
Parameters:
Name | Type |
---|---|
data | Type |
context | GraphbackContext |
Returns: Promise‹Type›
Private
usePage#
▸ usePage(query
: QueryBuilder, page?
: GraphbackPage): QueryBuilder‹any, any›
Defined in KnexDBDataProvider.ts:127
Parameters:
Name | Type |
---|---|
query | QueryBuilder |
page? | GraphbackPage |
Returns: QueryBuilder‹any, any›