GraphbackCRUDService
Graphback layered architecture component that can be called from the resolver layer in GraphQL and Middlerware layer in RESTfull approach.
Graphback implements server side procesing using following flow:
GraphQL Resolvers
-> GraphbackCRUDService
[1-*] -> GraphbackDataProvider
Services can be composable (each service can reference multiple layers of other services).
For data abstraction Graphback GraphbackDataProvider
can be being used.
see
GraphbackDataProvider
#
Type parameters▪ Type
▪ GraphbackContext
#
Hierarchy- GraphbackCRUDService
#
Implemented by#
Index#
Methods#
Methods#
batchLoadData▸ batchLoadData(relationField
: string, id
: string | number, filter
: any, context
: any): any
Defined in packages/graphback-core/src/runtime/GraphbackCRUDService.ts:102
Speciallized function that can utilize batching the data basing on DataLoader library
Parameters:
Name | Type | Description |
---|---|---|
relationField | string | name of the field that will be used to match ids |
id | string | number | id of the object we want to load |
filter | any | - |
context | any | resolver context object that will be used to apply new loader |
Returns: any
#
create▸ create(data
: Type, context
: GraphbackContext): Promise‹Type›
Defined in packages/graphback-core/src/runtime/GraphbackCRUDService.ts:32
Implementation for object creation
Parameters:
Name | Type | Description |
---|---|---|
data | Type | input data |
context | GraphbackContext | context 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/GraphbackCRUDService.ts:48
Implementation for object deletes
Parameters:
Name | Type | Description |
---|---|---|
data | Type | data used for consistency reasons |
context | GraphbackContext | context object passed from graphql or rest layer |
Returns: Promise‹Type›
#
findBy▸ findBy(filter
: QueryFilter‹Type›, context
: GraphbackContext, page?
: GraphbackPage, orderBy?
: any): Promise‹ResultList‹Type››
Defined in packages/graphback-core/src/runtime/GraphbackCRUDService.ts:66
Implementation for reading objects with filtering capabilities
Parameters:
Name | Type | Description |
---|---|---|
filter | QueryFilter‹Type› | filter by specific type |
context | GraphbackContext | context object passed from graphql or rest layer |
page? | GraphbackPage | pagination options |
orderBy? | any | optionally sort the results by a column |
Returns: Promise‹ResultList‹Type››
#
findOne▸ findOne(filter
: Type, context
: GraphbackContext): Promise‹Type›
Defined in packages/graphback-core/src/runtime/GraphbackCRUDService.ts:56
Fetch a single record by its unique attribute(s)
Parameters:
Name | Type | Description |
---|---|---|
filter | Type | the unique attributes to fetch the record with |
context | GraphbackContext | context object from GraphQL/REST layer |
Returns: Promise‹Type›
#
subscribeToCreate▸ subscribeToCreate(filter?
: any, context?
: GraphbackContext): AsyncIterator‹Type› | undefined
Defined in packages/graphback-core/src/runtime/GraphbackCRUDService.ts:74
Subscription for all creation events
Parameters:
Name | Type | Description |
---|---|---|
filter? | any | filter used in subscription |
context? | GraphbackContext | additional context |
Returns: AsyncIterator‹Type› | undefined
#
subscribeToDelete▸ subscribeToDelete(filter?
: any, context?
: GraphbackContext): AsyncIterator‹Type› | undefined
Defined in packages/graphback-core/src/runtime/GraphbackCRUDService.ts:90
Subscription for all deletion events
Parameters:
Name | Type | Description |
---|---|---|
filter? | any | filter used in subscription |
context? | GraphbackContext | additional context |
Returns: AsyncIterator‹Type› | undefined
#
subscribeToUpdate▸ subscribeToUpdate(filter?
: any, context?
: GraphbackContext): AsyncIterator‹Type› | undefined
Defined in packages/graphback-core/src/runtime/GraphbackCRUDService.ts:82
Subscription for all update events
Parameters:
Name | Type | Description |
---|---|---|
filter? | any | filter used in subscription |
context? | GraphbackContext | additional context |
Returns: AsyncIterator‹Type› | undefined
#
update▸ update(data
: Type, context
: GraphbackContext): Promise‹Type›
Defined in packages/graphback-core/src/runtime/GraphbackCRUDService.ts:40
Implementation for object updates
Parameters:
Name | Type | Description |
---|---|---|
data | Type | input data including id |
context | GraphbackContext | context object passed from graphql or rest layer |
Returns: Promise‹Type›