graphql.dataloader
Modules
Module graphql.dataloader
![](https://bcentral-packageicons.azureedge.net/images/ballerina_graphql_1.12.0.png)
ballerina/graphql.dataloader Ballerina library
Classes![](/images/permalink.svg)
graphql.dataloader: DefaultDataLoader![](/images/permalink.svg)
Represents a default implementation of the DataLoader.
Constructor![](/images/permalink.svg)
Initializes the DataLoader with the given batch function.
init (BatchLoadFunction loadFunction)
- loadFunction BatchLoadFunction - The batch function to be used
add![](/images/permalink.svg)
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![](/images/permalink.svg)
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![](/images/permalink.svg)
function dispatch()
Dispatches a user-defined batch load operation for all keys that have been collected.
clearAll![](/images/permalink.svg)
function clearAll()
Clears all the keys and results from the data loader cache.
Object types![](/images/permalink.svg)
graphql.dataloader: DataLoader![](/images/permalink.svg)
Represents a DataLoader object that can be used to load data from a data source.
add![](/images/permalink.svg)
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![](/images/permalink.svg)
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![](/images/permalink.svg)
function dispatch()
Dispatches a user-defined batch load operation for all keys that have been collected.
clearAll![](/images/permalink.svg)
function clearAll()
Clears all the keys and results from the data loader cache.
Function types![](/images/permalink.svg)
graphql.dataloader: BatchLoadFunction![](/images/permalink.svg)
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: about 2 months ago
Version: 1.12.0
License: Apache-2.0
Compatibility
Platform: java17
Ballerina version: 2201.9.0
GraalVM compatible: Yes
Pull count
Total: 73955
Current verison: 32
Weekly downloads
Keywords
gql
network
query
service
Contributors