All Projects → graph-gophers → Dataloader

graph-gophers / Dataloader

Licence: mit
Implementation of Facebook's DataLoader in Golang

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Dataloader

Dataloader Php
DataLoaderPhp is a generic utility to be used as part of your application's data fetching layer to provide a simplified and consistent API over various remote data sources such as databases or web services via batching and caching.
Stars: ✭ 160 (-77.24%)
Mutual labels:  graphql, dataloader, cache
Apollo Cache Invalidation
Experimental cache invalidation tools for Apollo.
Stars: ✭ 66 (-90.61%)
Mutual labels:  graphql, cache
Offix
GraphQL Offline Client and Server
Stars: ✭ 694 (-1.28%)
Mutual labels:  graphql, cache
Nestjs Example
NestJS example with GraphQL, Schema-Stitching, Dataloader, GraphQL Upload, RabbitMQ, Redis, Scalable Websocket and JWT authentication
Stars: ✭ 111 (-84.21%)
Mutual labels:  graphql, dataloader
Graphql Serverless
Sample project to guide the use of GraphQL and Serverless Architecture.
Stars: ✭ 28 (-96.02%)
Mutual labels:  graphql, dataloader
Apollo Invalidation Policies
An extension of the Apollo 3 cache with support for type-based invalidation policies.
Stars: ✭ 55 (-92.18%)
Mutual labels:  graphql, cache
Superlifter
A DataLoader for Clojure/script
Stars: ✭ 102 (-85.49%)
Mutual labels:  graphql, dataloader
Typeorm Graphql Loader
A query builder to easily resolve nested fields and relations for TypeORM-based GraphQL servers
Stars: ✭ 47 (-93.31%)
Mutual labels:  graphql, dataloader
Hotchocolate
Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
Stars: ✭ 3,009 (+328.02%)
Mutual labels:  graphql, dataloader
Gqlgen
go generate based graphql server library
Stars: ✭ 6,880 (+878.66%)
Mutual labels:  graphql, dataloader
Batch Loader
⚡️ Powerful tool for avoiding N+1 DB or HTTP queries
Stars: ✭ 812 (+15.5%)
Mutual labels:  graphql, dataloader
React Query
⚛️ Hooks for fetching, caching and updating asynchronous data in React
Stars: ✭ 24,427 (+3374.68%)
Mutual labels:  graphql, cache
Type Graphql Dataloader
TypeGraphQL + DataLoader + TypeORM made easy
Stars: ✭ 73 (-89.62%)
Mutual labels:  graphql, dataloader
Dataloader
DataLoader is a generic utility to be used as part of your application's data fetching layer to provide a consistent API over various backends and reduce requests to those backends via batching and caching.
Stars: ✭ 11,040 (+1470.41%)
Mutual labels:  graphql, dataloader
Java Dataloader
A Java 8 port of Facebook DataLoader
Stars: ✭ 367 (-47.8%)
Mutual labels:  graphql, dataloader
Graphql Dataloader Boilerplate
Very simple boilerplate using GraphQL and DataLoader
Stars: ✭ 405 (-42.39%)
Mutual labels:  graphql, dataloader
Reservoir
Android library to easily serialize and cache your objects to disk using key/value pairs.
Stars: ✭ 674 (-4.13%)
Mutual labels:  cache
Testing Nestjs
A repository to show off to the community methods of testing NestJS including Unit Tests, Integration Tests, E2E Tests, pipes, filters, interceptors, GraphQL, Mongo, TypeORM, and more!
Stars: ✭ 685 (-2.56%)
Mutual labels:  graphql
Jira clone
A Jira clone built with Vuejs & Nodejs/Graphql
Stars: ✭ 666 (-5.26%)
Mutual labels:  graphql
Elm Graphql
Autogenerate type-safe GraphQL queries in Elm.
Stars: ✭ 672 (-4.41%)
Mutual labels:  graphql

DataLoader

GoDoc Build Status

This is an implementation of Facebook's DataLoader in Golang.

Install

go get -u github.com/graph-gophers/dataloader

Usage

// setup batch function
batchFn := func(ctx context.Context, keys dataloader.Keys) []*dataloader.Result {
  var results []*dataloader.Result
  // do some async work to get data for specified keys
  // append to this list resolved values
  return results
}

// create Loader with an in-memory cache
loader := dataloader.NewBatchedLoader(batchFn)

/**
 * Use loader
 *
 * A thunk is a function returned from a function that is a
 * closure over a value (in this case an interface value and error).
 * When called, it will block until the value is resolved.
 */
thunk := loader.Load(context.TODO(), dataloader.StringKey("key1")) // StringKey is a convenience method that make wraps string to implement `Key` interface
result, err := thunk()
if err != nil {
  // handle data error
}

log.Printf("value: %#v", result)

Don't need/want to use context?

You're welcome to install the v1 version of this library.

Cache

This implementation contains a very basic cache that is intended only to be used for short lived DataLoaders (i.e. DataLoaders that ony exsist for the life of an http request). You may use your own implementation if you want.

it also has a NoCache type that implements the cache interface but all methods are noop. If you do not wish to cache anything.

Examples

There are a few basic examples in the example folder.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].