Version: 0.15.x

GraphbackDataProvider

Graphback layered architecture component that can be called from the service layer in both RESTFULL and GraphQL middlewares.

Graphback implements server side procesing using following flow:

GraphQL Resolvers -> GraphbackCRUDService [1-*] -> GraphbackDataProvider

Data layer can be composable (each provider can reference multiple layers of other providers).

see GraphbackCRUDService

Type parameters#

Type

GraphbackContext

Hierarchy#

  • GraphbackDataProvider

Index#

Methods#

Methods#

batchRead#

batchRead(relationField: string, ids: string[], filter: any, context: GraphbackContext): Promise‹Type[][]›

Defined in packages/graphback-core/src/runtime/GraphbackDataProvider.ts:78

Read multiple items by their id's (used for lazy data loading purposes)

Parameters:

NameTypeDescription
relationFieldstringname of the field that will be used to match ids
idsstring[]array of identifiers that needs to be fetched
filteranyfilter by specific type
contextGraphbackContextfields to select from datasource

Returns: Promise‹Type[][]›


count#

count(filter: any): Promise‹number›

Defined in packages/graphback-core/src/runtime/GraphbackDataProvider.ts:68

Implementation for counting number of objects with filtering capabilities

Parameters:

NameTypeDescription
filteranyfilter by specific type

Returns: Promise‹number›


create#

create(data: Type, context: GraphbackContext): Promise‹Type›

Defined in packages/graphback-core/src/runtime/GraphbackDataProvider.ts:26

Implementation for object creation

Parameters:

NameTypeDescription
dataTypeinput data
contextGraphbackContextcontext object passed from graphql or rest layer

Returns: Promise‹Type›


delete#

delete(data: Type, context: GraphbackContext): Promise‹Type›

Defined in packages/graphback-core/src/runtime/GraphbackDataProvider.ts:44

Implementation for object deletes

Parameters:

NameTypeDescription
dataTypedata used for checking consistency
contextGraphbackContextcontext object passed from graphql or rest layer

Returns: Promise‹Type›


findBy#

findBy(filter: QueryFilter‹Type›, context: GraphbackContext, page?: GraphbackPage, orderBy?: GraphbackOrderBy): Promise‹Type[]›

Defined in packages/graphback-core/src/runtime/GraphbackDataProvider.ts:61

Implementation for reading objects with filtering capabilities

Parameters:

NameTypeDescription
filterQueryFilter‹Type›filter by specific type
contextGraphbackContextcontext object passed from graphql or rest layer
page?GraphbackPagepaging context
orderBy?GraphbackOrderBygives the ability to order the results based on a field in ascending or descending order

Returns: Promise‹Type[]›


findOne#

findOne(args: Partial‹Type›, context: GraphbackContext): Promise‹Type›

Defined in packages/graphback-core/src/runtime/GraphbackDataProvider.ts:52

Implementation for finding a single unique object

Parameters:

NameTypeDescription
argsPartial‹Type›filter by unique attriburtes
contextGraphbackContextcontext object passed from graphql or rest layer

Returns: Promise‹Type›


update#

update(data: Type, context: GraphbackContext): Promise‹Type›

Defined in packages/graphback-core/src/runtime/GraphbackDataProvider.ts:35

Implementation for object updates

Parameters:

NameTypeDescription
dataTypeinput data
contextGraphbackContextcontext object passed from graphql or rest layer

Returns: Promise‹Type›