Skip to content

Query #4

@ryannealmes

Description

@ryannealmes

I have been trying to get to grips with DataLoaders and coming across your repo has really helped. I was a bit tripped up by how you actually use the data loaders though and thought I would ask so I can learn from what you have done.

In your base model class you have

import SWAPIConnector from '../connectors/swapi'

export default class BaseModel {
  protected connector: SWAPIConnector

  constructor(connector) {
    this.connector = connector
  }

  public getConnections(urls: Array<string>) {
    return this.connector.loader.loadMany(urls)
  }
  public getConnection(url: string) {
    return this.connector.loader.load(url)
  }
}

Are connections just a layer of abstraction you introduced so you don't have to expose the actual loader to your resolvers?

I am getting a little confused with the graphql swapi api which uses connections for pagination (from my understanding). Is there any parallel between the two?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions