How to use the faunadb.query.Match function in faunadb

To help you get started, we’ve selected a few faunadb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fauna / todomvc-fauna-spa / src / Login.js View on Github external
doLogin () {
    console.log(this.state)
    publicClient.query(q.Login(q.Match(q.Index("users_by_login"), this.state.login), {
        password : this.state.password
    })).then((key) => {
      saveTokens(key.secret);
      this.authorized(false);
    })
  }
  ["doSign Up"] () {
github fauna / fauna-market / src / model.js View on Github external
queryItemsForSale() {
    return this.client.query(
      q.Map(
        q.Paginate(q.Match(q.Index("items_for_sale"), true)),
        (row) =>
        q.Let({doc : q.Get(row)}, {
          ref : q.Select(["ref"], q.Var("doc")),
          data : {
            label : q.Select(["data","label"], q.Var("doc")),
            price : q.Select(["data","price"], q.Var("doc")),
            owner : q.Select(["data","owner"], q.Var("doc")),
            owner_name :
              q.Select(["data","name"],
              q.Get(q.Select(["data","owner"], q.Var("doc"))))
          }
        })
      )
    );
  }
github fauna / fauna-market / src / model.js View on Github external
listPlayers() {
    return this.client.query(
      q.Map(
        q.Paginate(q.Match(q.Index("players"))),
        (row) => q.Get(row)
      )
    );
  }
github fauna / todomvc-fauna-spa / src / Login.js View on Github external
})).then(() => publicClient.query(
      q.Login(q.Match(q.Index("users_by_login"), this.state.login), {
        password : this.state.password
    }))).then((key) => {
      saveTokens(key.secret);
github fauna / fauna-market / src / model.js View on Github external
listPurchases() {
    return this.client.query(
      q.Map(
        q.Paginate(q.Match(q.Index("purchases")), {before : null}),
        (row) => q.Let({row:q.Get(row)},
          q.Let({
            buyer : q.Get(q.Select(["data","buyer"], q.Var("row"))),
            seller : q.Get(q.Select(["data","seller"], q.Var("row"))),
            price : q.Select(["data","price"], q.Var("row")),
            item : q.Get(q.Select(["data","item"], q.Var("row")))
          },
          {
            buyer : q.Select(["data","name"], q.Var("buyer")),
            seller : q.Select(["data","name"], q.Var("seller")),
            price : q.Var("price"),
            label : q.Select(["data","label"], q.Var("item")),
            key : q.Select(["ref"], q.Var("row"))
          }
        ))
      )