graphql.dataloader
Modules
Module graphql.dataloader
ballerina/graphql.dataloader Ballerina library
Classes
graphql.dataloader: DefaultDataLoader
Represents a default implementation of the DataLoader.
Constructor
Initializes the DataLoader with the given batch function.
init (BatchLoadFunction loadFunction)
- loadFunction BatchLoadFunction - The batch function to be used
add
function add(anydata key)
Collects a key to perform a batch operation at a later time.
Parameters
- key anydata - The key to load later
get
function get(anydata key, typedesc<anydata> 'type) returns 'type|error
Retrieves the result for a particular key.
Parameters
- key anydata - The key to retrieve the result
- 'type typedesc<anydata> (default <>) - The type of the result
Return Type
- 'type|error - The result for the key on success, error on failure
dispatch
function dispatch()
Dispatches a user-defined batch load operation for all keys that have been collected.
clearAll
function clearAll()
Clears all the keys and results from the data loader cache.
Object types
graphql.dataloader: DataLoader
Represents a DataLoader object that can be used to load data from a data source.
add
function add(anydata key)
Collects a key to perform a batch operation at a later time.
Parameters
- key anydata - The key to load later
get
function get(anydata key, typedesc<anydata> 'type) returns 'type|error
Retrieves the result for a particular key.
Parameters
- key anydata - The key to retrieve the result
- 'type typedesc<anydata> (default <>) - The type of the result
Return Type
- 'type|error - The result for the key on success, error on failure
dispatch
function dispatch()
Dispatches a user-defined batch load operation for all keys that have been collected.
clearAll
function clearAll()
Clears all the keys and results from the data loader cache.
Function types
graphql.dataloader: BatchLoadFunction
function(readonly & anydata[]) returns (anydata[]|error)
BatchLoadFunction
Represents the type of the batch function to be used in the DataLoader.
Import
import ballerina/graphql.dataloader;
Metadata
Released date: 5 months ago
Version: 1.11.1
License: Apache-2.0
Compatibility
Platform: java17
Ballerina version: 2201.8.5
GraalVM compatible: Yes
Pull count
Total: 88196
Current verison: 1373
Weekly downloads
Keywords
gql
network
query
service
Contributors
Dependents