Skip to content

Instantly share code, notes, and snippets.

@jbaxleyiii
Last active January 4, 2018 15:50
Show Gist options
  • Select an option

  • Save jbaxleyiii/17a3a14dae65baac457250eacebf1608 to your computer and use it in GitHub Desktop.

Select an option

Save jbaxleyiii/17a3a14dae65baac457250eacebf1608 to your computer and use it in GitHub Desktop.
open Data;
let typeDef = {|
type Author {
id: Int!
firstName: String
lastName: String
posts: [Post] # the list of Posts by this author
}
|};
type resolvers = {. "posts": Js.Array.t(post)};
let resolvers = {
"posts": (author: Data.author) =>
Js.Array.filter((post) => post##authorId === author##id, posts)
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment