Giter Site home page Giter Site logo

shamshirz / scoreboard Goto Github PK

View Code? Open in Web Editor NEW
35.0 1.0 9.0 69 KB

Intro to Absinthe & Dataloader

Home Page: https://damp-beach-31852.herokuapp.com/

Elixir 100.00%
elixir elixir-lang absinthe absinthe-graphql dataloader graphiql ecto phoenix

scoreboard's People

Contributors

shamshirz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

scoreboard's Issues

Question: apply param for player_id

Hey Aaron - thanks for the talk you made at the ElixirConf and making this repo available. I have a quick question about this line here:

def apply_param({:player_id, player_id}, queryable),

def query(Score, params) do
    params
    |> Map.put_new(:limit, 10)
    |> Map.put_new(:order, :total)
    |> Map.to_list()
    |> Enum.reduce(Score, &apply_param/2)
  end

  def query(queryable, _params), do: queryable

  @doc """
  reduce function
  """
  def apply_param({:limit, num}, queryable), do: queryable |> limit(^num)
  def apply_param({:order, field}, queryable), do: queryable |> order_by(desc: ^field)

  def apply_param({:player_id, player_id}, queryable), #specifically this pattern
    do: queryable |> where(player_id: ^player_id)

Is the player_id pattern ever matched on in this solution? I ask because I don't see it added to the Map in the query, is the dataloader matching on this function some other way or do you need to specifically hook it up within def query(Score, params)?

Thanks again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.