Class

Class( name )
Class( name )
Class( name )
client.query(Class( name )
class_expr( name )
class_ name
client.query(Class( name )
Class( name )

Description

The Class function returns a valid Ref for the given class name.

Parameters

Argument Type Definition and Requirements

name

String

The name of a class.

Returns

A reference to a class with the provided name.

Examples

The query below gets a reference to the class named "spells".

curl https://db.fauna.com/ \
    -u fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL: \
    -d '{ "class": "spells" }'
client.Query(Class("spells"));
System.out.println(client.query(Class(Value("spells"))).get());
result, _ := client.Query(f.Class("spells"))

fmt.Println(result)
client.query(Class("spells"))
client.query(q.class_expr("spells"))
$client.query do
  class_ 'spells'
end
client.query(Class("spells"))
client.query(q.Class("spells"))
  .then((ret) => console.log(ret))
HTTP/1.1 200 OK
{ "resource": { "@ref": "classes/spells" } }
{ "@ref": "classes/spells" }
ref(id = "spells", class = ref(id = "classes"))
{spells 0xc4202cf140 <nil>}
{ "@ref": "classes/spells" }
{ "@ref": "classes/spells" }
{ "@ref": "classes/spells" }
{ "@ref": "classes/spells" }
Ref(id=spells, class=Ref(id=classes))

Was this article helpful?

We're sorry to hear that.
Tell us how we can improve! documentation@fauna.com

Thank you for your feedback!