Documentation

Overview

    Package faunadb implements the FaunaDB query language for Golang applications.

    FaunaClient is the main client structure, containing methods to communicate with a FaunaDB Cluster. This structure is designed to be reused, so avoid making copies of it.

    FaunaDB's query language is composed of expressions that implement the Expr interface. Expressions are created using the query language functions found in query.go.

    Responses returned by FaunaDB are wrapped into types that implement the Value interface. This interface provides methods for transversing and decoding FaunaDB values into native Go types.

    The driver allows for the user to encode custom data structures. You can create your own struct and encode it as a valid FaunaDB object.

    type User struct {
    	Name string
    	Age  int
    }
    
    user := User{"John", 24} // Encodes as: {"Name": "John", "Age": 24}
    

    If you wish to control the property names, you can tag them with the "fauna" tag:

    type User struct {
    	Name string `fauna:"displayName"`
    	Age  int    `fauna:"age"`
    }
    
    user := User{"John", 24} // Encodes as: {"displayName": "John", "age": 24}
    

    For more information about FaunaDB, check https://fauna.com/.

    Example
    Output:
    
    

    Index

    Examples

    Constants

    View Source
    const (
    	ActionCreate = "create"
    	ActionDelete = "delete"
    )

      Event's action types. Usually used as a parameter for Insert or Remove functions.

      See: https://fauna.com/documentation/queries#values-events

      View Source
      const (
      	TimeUnitSecond      = "second"
      	TimeUnitMillisecond = "millisecond"
      	TimeUnitMicrosecond = "microsecond"
      	TimeUnitNanosecond  = "nanosecond"
      )

        Time unit. Usually used as a parameter for Epoch function.

        See: https://fauna.com/documentation/queries#time_functions-epoch_num_unit_unit

        Variables

        This section is empty.

        Functions

        This section is empty.

        Types

        type Arr

        type Arr []interface{}

          Arr is a expression shortcut to represent any valid JSON array

          func (Arr) MarshalJSON

          func (arr Arr) MarshalJSON() ([]byte, error)

            MarshalJSON implements json.Marshaler for Arr expression

            type ArrayV

            type ArrayV []Value

              ArrayV represents a FaunaDB array type.

              func (ArrayV) At

              func (arr ArrayV) At(field Field) FieldValue

                At implements the Value interface by transversing the array and extracting the field informed.

                func (ArrayV) Get

                func (arr ArrayV) Get(i interface{}) error

                  Get implements the Value interface by decoding the underlying value to either an ArrayV or a native slice type.

                  type BadRequest

                  type BadRequest struct{ FaunaError }

                    A BadRequest wraps an HTTP 400 error response.

                    type BooleanV

                    type BooleanV bool

                      BooleanV represents a valid JSON boolean.

                      func (BooleanV) At

                      func (boolean BooleanV) At(field Field) FieldValue

                        At implements the Value interface by returning an invalid field since BooleanV is not transversable.

                        func (BooleanV) Get

                        func (boolean BooleanV) Get(i interface{}) error

                          Get implements the Value interface by decoding the underlying value to either a BooleanV or a boolean type.

                          type BytesV

                          type BytesV []byte

                            BytesV represents a FaunaDB binary blob type.

                            func (BytesV) At

                            func (bytes BytesV) At(field Field) FieldValue

                              At implements the Value interface by returning an invalid field since BytesV is not transversable.

                              func (BytesV) Get

                              func (bytes BytesV) Get(i interface{}) error

                                Get implements the Value interface by decoding the underlying value to either a ByteV or a []byte type.

                                func (BytesV) MarshalJSON

                                func (bytes BytesV) MarshalJSON() ([]byte, error)

                                  MarshalJSON implements json.Marshaler by escaping its value according to FaunaDB bytes representation.

                                  type ClientConfig

                                  type ClientConfig func(*FaunaClient)

                                    ClientConfig is the base type for the configuration parameters of a FaunaClient.

                                    func EnableTxnTimePassthrough

                                    func EnableTxnTimePassthrough() ClientConfig

                                      EnableTxnTimePassthrough configures the FaunaClient to keep track of the last seen transaction time. The last seen transaction time is used to avoid reading stale data from outdated replicas when reading and writing from different nodes at the same time.

                                      func Endpoint

                                      func Endpoint(url string) ClientConfig

                                        Endpoint configures the FaunaDB URL for a FaunaClient.

                                        func HTTP

                                        func HTTP(http *http.Client) ClientConfig

                                          HTTP allows the user to override the http.Client used by a FaunaClient.

                                          type DateV

                                          type DateV time.Time

                                            DateV represents a FaunaDB date type.

                                            func (DateV) At

                                            func (date DateV) At(field Field) FieldValue

                                              At implements the Value interface by returning an invalid field since DateV is not transversable.

                                              func (DateV) Get

                                              func (date DateV) Get(i interface{}) error

                                                Get implements the Value interface by decoding the underlying value to either a DateV or a time.Time type.

                                                func (DateV) MarshalJSON

                                                func (date DateV) MarshalJSON() ([]byte, error)

                                                  MarshalJSON implements json.Marshaler by escaping its value according to FaunaDB date representation.

                                                  type DecodeError

                                                  type DecodeError struct {
                                                  	// contains filtered or unexported fields
                                                  }

                                                    A DecodeError describes an error when decoding a Fauna Value to a native Golang type

                                                    func (DecodeError) Error

                                                    func (d DecodeError) Error() string

                                                    type DoubleV

                                                    type DoubleV float64

                                                      DoubleV represents a valid JSON double.

                                                      func (DoubleV) At

                                                      func (num DoubleV) At(field Field) FieldValue

                                                        At implements the Value interface by returning an invalid field since DoubleV is not transversable.

                                                        func (DoubleV) Get

                                                        func (num DoubleV) Get(i interface{}) error

                                                          Get implements the Value interface by decoding the underlying value to either a DoubleV or a float type.

                                                          type Expr

                                                          type Expr interface {
                                                          	// contains filtered or unexported methods
                                                          }

                                                            Expr is the base type for FaunaDB query language expressions.

                                                            Expressions are created by using the query language functions in query.go. Query functions are designed to compose with each other, as well as with custom data structures. For example:

                                                            type User struct {
                                                            	Name string
                                                            }
                                                            
                                                            _, _ := client.Query(
                                                            	Create(
                                                            		Ref("classes/users"),
                                                            		Obj{"data": User{"John"}},
                                                            	),
                                                            )
                                                            

                                                            func Abort

                                                            func Abort(msg interface{}) Expr

                                                              Abort aborts the execution of the query

                                                              See: https://fauna.com/documentation/queries#basic_forms

                                                              func Add

                                                              func Add(args ...interface{}) Expr

                                                                Add computes the sum of a list of numbers.

                                                                See: https://fauna.com/documentation/queries#misc_functions

                                                                func And

                                                                func And(args ...interface{}) Expr

                                                                  And returns the conjunction of a list of boolean values.

                                                                  See: https://fauna.com/documentation/queries#misc_functions

                                                                  func Append

                                                                  func Append(elems, coll interface{}) Expr

                                                                    Append returns a new collection that is the result of appending elems to coll.

                                                                    See: https://fauna.com/documentation/queries#collection_functions

                                                                    func At

                                                                    func At(timestamp, expr interface{}) Expr

                                                                      At execute an expression at a given timestamp.

                                                                      See: https://fauna.com/documentation/queries#basic_forms

                                                                      func Call

                                                                      func Call(ref interface{}, args ...interface{}) Expr

                                                                        Call invokes the specified function passing in a variable number of arguments

                                                                        See: https://fauna.com/documentation/queries#basic_forms

                                                                        func Casefold

                                                                        func Casefold(str interface{}, options ...OptionalParameter) Expr

                                                                          Casefold normalizes strings according to the Unicode Standard section 5.18 "Case Mappings".

                                                                          See: https://fauna.com/documentation/queries#string_functions

                                                                          func Class

                                                                          func Class(name interface{}) Expr

                                                                            Class creates a new class ref.

                                                                            See: https://fauna.com/documentation/queries#misc_functions

                                                                            func Classes

                                                                            func Classes() Expr

                                                                              Classes creates a native ref for classes.

                                                                              See: https://fauna.com/documentation/queries#misc_functions

                                                                              func Concat

                                                                              func Concat(terms interface{}, options ...OptionalParameter) Expr

                                                                                Concat concatenates a list of strings into a single string. Optional parameters: Separator.

                                                                                See: https://fauna.com/documentation/queries#string_functions

                                                                                func Contains

                                                                                func Contains(path, value interface{}) Expr

                                                                                  Contains checks if the value informed contains the path specified.

                                                                                  See: https://fauna.com/documentation/queries#misc_functions

                                                                                  func Create

                                                                                  func Create(ref, params interface{}) Expr

                                                                                    Create creates an instance of the specified class.

                                                                                    See: https://fauna.com/documentation/queries#write_functions

                                                                                    func CreateClass

                                                                                    func CreateClass(params interface{}) Expr

                                                                                      CreateClass creates a new class.

                                                                                      See: https://fauna.com/documentation/queries#write_functions

                                                                                      func CreateDatabase

                                                                                      func CreateDatabase(params interface{}) Expr

                                                                                        CreateDatabase creates an new database.

                                                                                        See: https://fauna.com/documentation/queries#write_functions

                                                                                        func CreateFunction

                                                                                        func CreateFunction(params interface{}) Expr

                                                                                          CreateFunction creates a new function.

                                                                                          See: https://fauna.com/documentation/queries#write_functions

                                                                                          func CreateIndex

                                                                                          func CreateIndex(params interface{}) Expr

                                                                                            CreateIndex creates a new index.

                                                                                            See: https://fauna.com/documentation/queries#write_functions

                                                                                            func CreateKey

                                                                                            func CreateKey(params interface{}) Expr

                                                                                              CreateKey creates a new key.

                                                                                              See: https://fauna.com/documentation/queries#write_functions

                                                                                              func Credentials

                                                                                              func Credentials() Expr

                                                                                                Credentials creates a native ref for credentials.

                                                                                                See: https://fauna.com/documentation/queries#misc_functions

                                                                                                func Database

                                                                                                func Database(name interface{}) Expr

                                                                                                  Database creates a new database ref.

                                                                                                  See: https://fauna.com/documentation/queries#misc_functions

                                                                                                  func Databases

                                                                                                  func Databases() Expr

                                                                                                    Databases creates a native ref for databases.

                                                                                                    See: https://fauna.com/documentation/queries#misc_functions

                                                                                                    func Date

                                                                                                    func Date(str interface{}) Expr

                                                                                                      Date constructs a date from a ISO 8601 offset date/time string.

                                                                                                      See: https://fauna.com/documentation/queries#time_functions

                                                                                                      func Delete

                                                                                                      func Delete(ref interface{}) Expr

                                                                                                        Delete deletes the provided instance.

                                                                                                        See: https://fauna.com/documentation/queries#write_functions

                                                                                                        func Difference

                                                                                                        func Difference(sets ...interface{}) Expr

                                                                                                          Difference returns the set of instances that are present in the source set but not in any of the other specified sets.

                                                                                                          See: https://fauna.com/documentation/queries#sets

                                                                                                          func Distinct

                                                                                                          func Distinct(set interface{}) Expr

                                                                                                            Distinct returns the set of instances with duplicates removed.

                                                                                                            See: https://fauna.com/documentation/queries#sets

                                                                                                            func Divide

                                                                                                            func Divide(args ...interface{}) Expr

                                                                                                              Divide computes the quotient of a list of numbers.

                                                                                                              See: https://fauna.com/documentation/queries#misc_functions

                                                                                                              func Do

                                                                                                              func Do(exprs ...interface{}) Expr

                                                                                                                Do sequentially evaluates its arguments, and returns the last expression. If no expressions are provided, do returns an error.

                                                                                                                See: https://fauna.com/documentation/queries#basic_forms

                                                                                                                func Drop

                                                                                                                func Drop(num, coll interface{}) Expr

                                                                                                                  Drop returns a new collection containing the remaining elements from the original collection after num elements have been removed.

                                                                                                                  See: https://fauna.com/documentation/queries#collection_functions

                                                                                                                  func Epoch

                                                                                                                  func Epoch(num, unit interface{}) Expr

                                                                                                                    Epoch constructs a time relative to the epoch "1970-01-01T00:00:00Z".

                                                                                                                    See: https://fauna.com/documentation/queries#time_functions

                                                                                                                    func Equals

                                                                                                                    func Equals(args ...interface{}) Expr

                                                                                                                      Equals checks if all args are equivalents.

                                                                                                                      See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                      func Events

                                                                                                                      func Events(refSet interface{}) Expr

                                                                                                                        Events returns the history of instance's data of the provided ref.

                                                                                                                        See: https://fauna.com/documentation/queries#sets

                                                                                                                        func Exists

                                                                                                                        func Exists(ref interface{}, options ...OptionalParameter) Expr

                                                                                                                          Exists returns boolean true if the provided ref exists (in the case of an instance), or is non-empty (in the case of a set), and false otherwise. Optional parameters: TS.

                                                                                                                          See: https://fauna.com/documentation/queries#read_functions

                                                                                                                          func Filter

                                                                                                                          func Filter(coll, lambda interface{}) Expr

                                                                                                                            Filter applies the lambda expression on each element of a collection or Page. It returns a new collection of the same type containing only the elements in which the function application returned true.

                                                                                                                            See: https://fauna.com/documentation/queries#collection_functions

                                                                                                                            func Foreach

                                                                                                                            func Foreach(coll, lambda interface{}) Expr

                                                                                                                              Foreach applies the lambda expression on each element of a collection or Page. The original collection is returned.

                                                                                                                              See: https://fauna.com/documentation/queries#collection_functions

                                                                                                                              func Function

                                                                                                                              func Function(name interface{}) Expr

                                                                                                                                Function create a new function ref.

                                                                                                                                See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                func Functions

                                                                                                                                func Functions() Expr

                                                                                                                                  Functions creates a native ref for functions.

                                                                                                                                  See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                  func GT

                                                                                                                                  func GT(args ...interface{}) Expr

                                                                                                                                    GT returns true if each specified value is greater than all subsequent values. Otherwise GT returns false. and false otherwise.

                                                                                                                                    See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                    func GTE

                                                                                                                                    func GTE(args ...interface{}) Expr

                                                                                                                                      GTE returns true if each specified value is greater than or equal to all subsequent values. Otherwise GTE returns false.

                                                                                                                                      See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                      func Get

                                                                                                                                      func Get(ref interface{}, options ...OptionalParameter) Expr

                                                                                                                                        Get retrieves the instance identified by the ref informed. Optional parameters: TS.

                                                                                                                                        See: https://fauna.com/documentation/queries#read_functions

                                                                                                                                        func HasIdentity

                                                                                                                                        func HasIdentity() Expr

                                                                                                                                          HasIdentity checks if the current key has an identity associated to it.

                                                                                                                                          See: https://fauna.com/documentation/queries#auth_functions

                                                                                                                                          func Identify

                                                                                                                                          func Identify(ref, password interface{}) Expr

                                                                                                                                            Identify checks the given password against the provided ref's credentials.

                                                                                                                                            See: https://fauna.com/documentation/queries#auth_functions

                                                                                                                                            func Identity

                                                                                                                                            func Identity() Expr

                                                                                                                                              Identity returns the instance reference associated with the current key.

                                                                                                                                              For example, the current key token created using:

                                                                                                                                              Create(Tokens(), Obj{"instance": someRef})
                                                                                                                                              

                                                                                                                                              or via:

                                                                                                                                              Login(someRef, Obj{"password":"sekrit"})
                                                                                                                                              

                                                                                                                                              will return "someRef" as the result of this function.

                                                                                                                                              See: https://fauna.com/documentation/queries#auth_functions

                                                                                                                                              func If

                                                                                                                                              func If(cond, then, elze interface{}) Expr

                                                                                                                                                If evaluates and returns then or elze depending on the value of cond. If cond evaluates to anything other than a boolean, if returns an “invalid argument” error

                                                                                                                                                See: https://fauna.com/documentation/queries#basic_forms

                                                                                                                                                func Index

                                                                                                                                                func Index(name interface{}) Expr

                                                                                                                                                  Index creates a new index ref.

                                                                                                                                                  See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                  func Indexes

                                                                                                                                                  func Indexes() Expr

                                                                                                                                                    Indexes creates a native ref for indexes.

                                                                                                                                                    See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                    func Insert

                                                                                                                                                    func Insert(ref, ts, action, params interface{}) Expr

                                                                                                                                                      Insert adds an event to the provided instance's history.

                                                                                                                                                      See: https://fauna.com/documentation/queries#write_functions

                                                                                                                                                      func Intersection

                                                                                                                                                      func Intersection(sets ...interface{}) Expr

                                                                                                                                                        Intersection returns the set of instances that are present in all of the specified sets.

                                                                                                                                                        See: https://fauna.com/documentation/queries#sets

                                                                                                                                                        func Join

                                                                                                                                                        func Join(source, target interface{}) Expr

                                                                                                                                                          Join derives a set of resources by applying each instance in the source set to the target set.

                                                                                                                                                          See: https://fauna.com/documentation/queries#sets

                                                                                                                                                          func KeyFromSecret

                                                                                                                                                          func KeyFromSecret(secret interface{}) Expr

                                                                                                                                                            KeyFromSecret retrieves the key object from the given secret.

                                                                                                                                                            See: https://fauna.com/documentation/queries#read_functions

                                                                                                                                                            func Keys

                                                                                                                                                            func Keys() Expr

                                                                                                                                                              Keys creates a native ref for keys.

                                                                                                                                                              See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                              func LT

                                                                                                                                                              func LT(args ...interface{}) Expr

                                                                                                                                                                LT returns true if each specified value is less than all the subsequent values. Otherwise LT returns false.

                                                                                                                                                                See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                func LTE

                                                                                                                                                                func LTE(args ...interface{}) Expr

                                                                                                                                                                  LTE returns true if each specified value is less than or equal to all subsequent values. Otherwise LTE returns false.

                                                                                                                                                                  See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                  func Lambda

                                                                                                                                                                  func Lambda(varName, expr interface{}) Expr

                                                                                                                                                                    Lambda creates an anonymous function. Mostly used with Collection functions.

                                                                                                                                                                    See: https://fauna.com/documentation/queries#basic_forms

                                                                                                                                                                    func Let

                                                                                                                                                                    func Let(bindings Obj, in interface{}) Expr

                                                                                                                                                                      Let binds values to one or more variables.

                                                                                                                                                                      See: https://fauna.com/documentation/queries#basic_forms

                                                                                                                                                                      func Login

                                                                                                                                                                      func Login(ref, params interface{}) Expr

                                                                                                                                                                        Login creates a token for the provided ref.

                                                                                                                                                                        See: https://fauna.com/documentation/queries#auth_functions

                                                                                                                                                                        func Logout

                                                                                                                                                                        func Logout(invalidateAll interface{}) Expr

                                                                                                                                                                          Logout deletes the current session token. If invalidateAll is true, logout will delete all tokens associated with the current session.

                                                                                                                                                                          See: https://fauna.com/documentation/queries#auth_functions

                                                                                                                                                                          func Map

                                                                                                                                                                          func Map(coll, lambda interface{}) Expr

                                                                                                                                                                            Map applies the lambda expression on each element of a collection or Page. It returns the result of each application on a collection of the same type.

                                                                                                                                                                            See: https://fauna.com/documentation/queries#collection_functions

                                                                                                                                                                            func Match

                                                                                                                                                                            func Match(ref interface{}) Expr

                                                                                                                                                                              Match returns the set of instances for the specified index.

                                                                                                                                                                              See: https://fauna.com/documentation/queries#sets

                                                                                                                                                                              func MatchTerm

                                                                                                                                                                              func MatchTerm(ref, terms interface{}) Expr

                                                                                                                                                                                MatchTerm returns th set of instances that match the terms in an index.

                                                                                                                                                                                See: https://fauna.com/documentation/queries#sets

                                                                                                                                                                                func Modulo

                                                                                                                                                                                func Modulo(args ...interface{}) Expr

                                                                                                                                                                                  Modulo computes the reminder after the division of a list of numbers.

                                                                                                                                                                                  See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                  func Multiply

                                                                                                                                                                                  func Multiply(args ...interface{}) Expr

                                                                                                                                                                                    Multiply computes the product of a list of numbers.

                                                                                                                                                                                    See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                    func NewId

                                                                                                                                                                                    func NewId() Expr

                                                                                                                                                                                      NewId produces a new identifier suitable for use when constructing refs.

                                                                                                                                                                                      See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                      func NextID

                                                                                                                                                                                      func NextID() Expr

                                                                                                                                                                                        NextID produces a new identifier suitable for use when constructing refs.

                                                                                                                                                                                        Deprecated: Use NewId instead

                                                                                                                                                                                        See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                        func Not

                                                                                                                                                                                        func Not(boolean interface{}) Expr

                                                                                                                                                                                          Not returns the negation of a boolean value.

                                                                                                                                                                                          See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                          func Null

                                                                                                                                                                                          func Null() Expr

                                                                                                                                                                                            Null creates a NullV value.

                                                                                                                                                                                            See: https://fauna.com/documentation/queries#values

                                                                                                                                                                                            func Or

                                                                                                                                                                                            func Or(args ...interface{}) Expr

                                                                                                                                                                                              Or returnsj the disjunction of a list of boolean values.

                                                                                                                                                                                              See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                              func Paginate

                                                                                                                                                                                              func Paginate(set interface{}, options ...OptionalParameter) Expr

                                                                                                                                                                                                Paginate retrieves a page from the set informed. Optional parameters: TS, After, Before, Size, EventsOpt, and Sources.

                                                                                                                                                                                                See: https://fauna.com/documentation/queries#read_functions

                                                                                                                                                                                                func Prepend

                                                                                                                                                                                                func Prepend(elems, coll interface{}) Expr

                                                                                                                                                                                                  Prepend returns a new collection that is the result of prepending elems to coll.

                                                                                                                                                                                                  See: https://fauna.com/documentation/queries#collection_functions

                                                                                                                                                                                                  func Query

                                                                                                                                                                                                  func Query(lambda interface{}) Expr

                                                                                                                                                                                                    Query creates an instance of the `@query` type with the specified lambda

                                                                                                                                                                                                    See: https://fauna.com/documentation/queries#basic_forms

                                                                                                                                                                                                    func Ref

                                                                                                                                                                                                    func Ref(id string) Expr

                                                                                                                                                                                                      Ref creates a new RefV value with the ID informed.

                                                                                                                                                                                                      See: https://fauna.com/documentation/queries#values-special_types

                                                                                                                                                                                                      func RefClass

                                                                                                                                                                                                      func RefClass(classRef, id interface{}) Expr

                                                                                                                                                                                                        RefClass creates a new Ref based on the class and ID informed.

                                                                                                                                                                                                        See: https://fauna.com/documentation/queries#values-special_types

                                                                                                                                                                                                        func Remove

                                                                                                                                                                                                        func Remove(ref, ts, action interface{}) Expr

                                                                                                                                                                                                          Remove deletes an event from the provided instance's history.

                                                                                                                                                                                                          See: https://fauna.com/documentation/queries#write_functions

                                                                                                                                                                                                          func Replace

                                                                                                                                                                                                          func Replace(ref, params interface{}) Expr

                                                                                                                                                                                                            Replace replaces the provided instance.

                                                                                                                                                                                                            See: https://fauna.com/documentation/queries#write_functions

                                                                                                                                                                                                            func ScopedClass

                                                                                                                                                                                                            func ScopedClass(name interface{}, scope interface{}) Expr

                                                                                                                                                                                                              ScopedClass creates a new class ref inside a database.

                                                                                                                                                                                                              See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                                              func ScopedClasses

                                                                                                                                                                                                              func ScopedClasses(scope interface{}) Expr

                                                                                                                                                                                                                ScopedClasses creates a native ref for classes inside a database.

                                                                                                                                                                                                                See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                                                func ScopedCredentials

                                                                                                                                                                                                                func ScopedCredentials(scope interface{}) Expr

                                                                                                                                                                                                                  ScopedCredentials creates a native ref for credentials inside a database.

                                                                                                                                                                                                                  See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                                                  func ScopedDatabase

                                                                                                                                                                                                                  func ScopedDatabase(name interface{}, scope interface{}) Expr

                                                                                                                                                                                                                    ScopedDatabase creates a new database ref inside a database.

                                                                                                                                                                                                                    See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                                                    func ScopedDatabases

                                                                                                                                                                                                                    func ScopedDatabases(scope interface{}) Expr

                                                                                                                                                                                                                      ScopedDatabases creates a native ref for databases inside a database.

                                                                                                                                                                                                                      See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                                                      func ScopedFunction

                                                                                                                                                                                                                      func ScopedFunction(name interface{}, scope interface{}) Expr

                                                                                                                                                                                                                        ScopedFunction creates a new function ref inside a database.

                                                                                                                                                                                                                        See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                                                        func ScopedFunctions

                                                                                                                                                                                                                        func ScopedFunctions(scope interface{}) Expr

                                                                                                                                                                                                                          ScopedFunctions creates a native ref for functions inside a database.

                                                                                                                                                                                                                          See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                                                          func ScopedIndex

                                                                                                                                                                                                                          func ScopedIndex(name interface{}, scope interface{}) Expr

                                                                                                                                                                                                                            ScopedIndex creates a new index ref inside a database.

                                                                                                                                                                                                                            See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                                                            func ScopedIndexes

                                                                                                                                                                                                                            func ScopedIndexes(scope interface{}) Expr

                                                                                                                                                                                                                              ScopedIndexes creates a native ref for indexes inside a database.

                                                                                                                                                                                                                              See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                                                              func ScopedKeys

                                                                                                                                                                                                                              func ScopedKeys(scope interface{}) Expr

                                                                                                                                                                                                                                ScopedKeys creates a native ref for keys inside a database.

                                                                                                                                                                                                                                See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                                                                func ScopedTokens

                                                                                                                                                                                                                                func ScopedTokens(scope interface{}) Expr

                                                                                                                                                                                                                                  ScopedTokens creates a native ref for tokens inside a database.

                                                                                                                                                                                                                                  See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                                                                  func Select

                                                                                                                                                                                                                                  func Select(path, value interface{}, options ...OptionalParameter) Expr

                                                                                                                                                                                                                                    Select traverses into the provided value, returning the value at the given path.

                                                                                                                                                                                                                                    See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                                                                    func SelectAll

                                                                                                                                                                                                                                    func SelectAll(path, value interface{}) Expr

                                                                                                                                                                                                                                      SelectAll traverses into the value informed flattening all values under the desired path.

                                                                                                                                                                                                                                      See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                                                                      func Singleton

                                                                                                                                                                                                                                      func Singleton(ref interface{}) Expr

                                                                                                                                                                                                                                        Singleton returns the history of the instance's presence of the provided ref.

                                                                                                                                                                                                                                        See: https://fauna.com/documentation/queries#sets

                                                                                                                                                                                                                                        func Subtract

                                                                                                                                                                                                                                        func Subtract(args ...interface{}) Expr

                                                                                                                                                                                                                                          Subtract computes the difference of a list of numbers.

                                                                                                                                                                                                                                          See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                                                                          func Take

                                                                                                                                                                                                                                          func Take(num, coll interface{}) Expr

                                                                                                                                                                                                                                            Take returns a new collection containing num elements from the head of the original collection.

                                                                                                                                                                                                                                            See: https://fauna.com/documentation/queries#collection_functions

                                                                                                                                                                                                                                            func Time

                                                                                                                                                                                                                                            func Time(str interface{}) Expr

                                                                                                                                                                                                                                              Time constructs a time from a ISO 8601 offset date/time string.

                                                                                                                                                                                                                                              See: https://fauna.com/documentation/queries#time_functions

                                                                                                                                                                                                                                              func Tokens

                                                                                                                                                                                                                                              func Tokens() Expr

                                                                                                                                                                                                                                                Tokens creates a native ref for tokens.

                                                                                                                                                                                                                                                See: https://fauna.com/documentation/queries#misc_functions

                                                                                                                                                                                                                                                func Union

                                                                                                                                                                                                                                                func Union(sets ...interface{}) Expr

                                                                                                                                                                                                                                                  Union returns the set of instances that are present in at least one of the specified sets.

                                                                                                                                                                                                                                                  See: https://fauna.com/documentation/queries#sets

                                                                                                                                                                                                                                                  func Update

                                                                                                                                                                                                                                                  func Update(ref, params interface{}) Expr

                                                                                                                                                                                                                                                    Update updates the provided instance.

                                                                                                                                                                                                                                                    See: https://fauna.com/documentation/queries#write_functions

                                                                                                                                                                                                                                                    func Var

                                                                                                                                                                                                                                                    func Var(name string) Expr

                                                                                                                                                                                                                                                      Var refers to a value of a variable on the current lexical scope.

                                                                                                                                                                                                                                                      See: https://fauna.com/documentation/queries#basic_forms

                                                                                                                                                                                                                                                      type FaunaClient

                                                                                                                                                                                                                                                      type FaunaClient struct {
                                                                                                                                                                                                                                                      	// contains filtered or unexported fields
                                                                                                                                                                                                                                                      }

                                                                                                                                                                                                                                                        FaunaClient provides methods for performing queries on a FaunaDB cluster.

                                                                                                                                                                                                                                                        This structure should be reused as much as possible. Avoid copying this structure. If you need to create a client with a different secret, use the NewSessionClient method.

                                                                                                                                                                                                                                                        func NewFaunaClient

                                                                                                                                                                                                                                                        func NewFaunaClient(secret string, configs ...ClientConfig) *FaunaClient

                                                                                                                                                                                                                                                          NewFaunaClient creates a new FaunaClient structure. Possible configuration options:

                                                                                                                                                                                                                                                          Endpoint: sets a specific FaunaDB url. Default: https://db.fauna.com
                                                                                                                                                                                                                                                          HTTP: sets a specific http.Client. Default: a new net.Client with 60 seconds timeout.
                                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                                          func (*FaunaClient) BatchQuery

                                                                                                                                                                                                                                                          func (client *FaunaClient) BatchQuery(exprs []Expr) (values []Value, err error)

                                                                                                                                                                                                                                                            BatchQuery will sends multiple simultaneous queries to FaunaDB. values are returned in the same order as the queries.

                                                                                                                                                                                                                                                            func (*FaunaClient) NewSessionClient

                                                                                                                                                                                                                                                            func (client *FaunaClient) NewSessionClient(secret string) *FaunaClient

                                                                                                                                                                                                                                                              NewSessionClient creates a new child FaunaClient with a new secret. The returned client reuses its parent's internal http resources.

                                                                                                                                                                                                                                                              func (*FaunaClient) Query

                                                                                                                                                                                                                                                              func (client *FaunaClient) Query(expr Expr) (value Value, err error)

                                                                                                                                                                                                                                                                Query is the primary method used to send a query language expression to FaunaDB.

                                                                                                                                                                                                                                                                type FaunaError

                                                                                                                                                                                                                                                                type FaunaError interface {
                                                                                                                                                                                                                                                                	error
                                                                                                                                                                                                                                                                	Status() int          // HTTP status code
                                                                                                                                                                                                                                                                	Errors() []QueryError // Errors returned by the server
                                                                                                                                                                                                                                                                }

                                                                                                                                                                                                                                                                  A FaunaError wraps HTTP errors when sending queries to a FaunaDB cluster.

                                                                                                                                                                                                                                                                  type Field

                                                                                                                                                                                                                                                                  type Field struct {
                                                                                                                                                                                                                                                                  	// contains filtered or unexported fields
                                                                                                                                                                                                                                                                  }

                                                                                                                                                                                                                                                                    Field is a field extractor for FaunaDB values.

                                                                                                                                                                                                                                                                    func ArrIndex

                                                                                                                                                                                                                                                                    func ArrIndex(indexes ...int) Field

                                                                                                                                                                                                                                                                      ArrIndex creates a field extractor for a JSON array based on the provided indexes.

                                                                                                                                                                                                                                                                      func ObjKey

                                                                                                                                                                                                                                                                      func ObjKey(keys ...string) Field

                                                                                                                                                                                                                                                                        ObjKey creates a field extractor for a JSON object based on the provided keys.

                                                                                                                                                                                                                                                                        func (Field) At

                                                                                                                                                                                                                                                                        func (f Field) At(other Field) Field

                                                                                                                                                                                                                                                                          At creates a new field extractor based on the provided path.

                                                                                                                                                                                                                                                                          func (Field) AtIndex

                                                                                                                                                                                                                                                                          func (f Field) AtIndex(indexes ...int) Field

                                                                                                                                                                                                                                                                            AtIndex creates a new field extractor based on the provided index.

                                                                                                                                                                                                                                                                            func (Field) AtKey

                                                                                                                                                                                                                                                                            func (f Field) AtKey(keys ...string) Field

                                                                                                                                                                                                                                                                              AtKey creates a new field extractor based on the provided key.

                                                                                                                                                                                                                                                                              type FieldValue

                                                                                                                                                                                                                                                                              type FieldValue interface {
                                                                                                                                                                                                                                                                              	GetValue() (Value, error) // GetValue returns the extracted FaunaDB value.
                                                                                                                                                                                                                                                                              	Get(i interface{}) error  // Get decodes a FaunaDB value to a native Go type.
                                                                                                                                                                                                                                                                              }

                                                                                                                                                                                                                                                                                FieldValue describes an extracted field value.

                                                                                                                                                                                                                                                                                type InternalError

                                                                                                                                                                                                                                                                                type InternalError struct{ FaunaError }

                                                                                                                                                                                                                                                                                  A InternalError wraps an HTTP 500 error response.

                                                                                                                                                                                                                                                                                  type InvalidFieldType

                                                                                                                                                                                                                                                                                  type InvalidFieldType struct {
                                                                                                                                                                                                                                                                                  	// contains filtered or unexported fields
                                                                                                                                                                                                                                                                                  }

                                                                                                                                                                                                                                                                                    InvalidFieldType describes an error that may occurs when extracting a field. InvalidFieldType will occur in the following cases: * When trying to extract a field by key from a something that is not an object, or * When trying to extract a field by index from something that is not an array.

                                                                                                                                                                                                                                                                                    func (InvalidFieldType) Error

                                                                                                                                                                                                                                                                                    func (i InvalidFieldType) Error() string

                                                                                                                                                                                                                                                                                    type LongV

                                                                                                                                                                                                                                                                                    type LongV int64

                                                                                                                                                                                                                                                                                      LongV represents a valid JSON number.

                                                                                                                                                                                                                                                                                      func (LongV) At

                                                                                                                                                                                                                                                                                      func (num LongV) At(field Field) FieldValue

                                                                                                                                                                                                                                                                                        At implements the Value interface by returning an invalid field since LongV is not transversable.

                                                                                                                                                                                                                                                                                        func (LongV) Get

                                                                                                                                                                                                                                                                                        func (num LongV) Get(i interface{}) error

                                                                                                                                                                                                                                                                                          Get implements the Value interface by decoding the underlying value to either a LongV or a numeric type.

                                                                                                                                                                                                                                                                                          type NotFound

                                                                                                                                                                                                                                                                                          type NotFound struct{ FaunaError }

                                                                                                                                                                                                                                                                                            A NotFound wraps an HTTP 404 error response.

                                                                                                                                                                                                                                                                                            type NullV

                                                                                                                                                                                                                                                                                            type NullV struct{}

                                                                                                                                                                                                                                                                                              NullV represents a valid JSON null.

                                                                                                                                                                                                                                                                                              func (NullV) At

                                                                                                                                                                                                                                                                                              func (null NullV) At(field Field) FieldValue

                                                                                                                                                                                                                                                                                                At implements the Value interface by returning an invalid field since NullV is not transversable.

                                                                                                                                                                                                                                                                                                func (NullV) Get

                                                                                                                                                                                                                                                                                                func (null NullV) Get(i interface{}) error

                                                                                                                                                                                                                                                                                                  Get implements the Value interface by decoding the underlying value to a either a NullV or a nil pointer.

                                                                                                                                                                                                                                                                                                  func (NullV) MarshalJSON

                                                                                                                                                                                                                                                                                                  func (null NullV) MarshalJSON() ([]byte, error)

                                                                                                                                                                                                                                                                                                    MarshalJSON implements json.Marshaler by escaping its value according to JSON null representation.

                                                                                                                                                                                                                                                                                                    type Obj

                                                                                                                                                                                                                                                                                                    type Obj map[string]interface{}

                                                                                                                                                                                                                                                                                                      Obj is a expression shortcut to represent any valid JSON object

                                                                                                                                                                                                                                                                                                      func (Obj) MarshalJSON

                                                                                                                                                                                                                                                                                                      func (obj Obj) MarshalJSON() ([]byte, error)

                                                                                                                                                                                                                                                                                                        MarshalJSON implements json.Marshaler for Obj expression

                                                                                                                                                                                                                                                                                                        type ObjectV

                                                                                                                                                                                                                                                                                                        type ObjectV map[string]Value

                                                                                                                                                                                                                                                                                                          ObjectV represents a FaunaDB object type.

                                                                                                                                                                                                                                                                                                          func (ObjectV) At

                                                                                                                                                                                                                                                                                                          func (obj ObjectV) At(field Field) FieldValue

                                                                                                                                                                                                                                                                                                            At implements the Value interface by transversing the object and extracting the field informed.

                                                                                                                                                                                                                                                                                                            func (ObjectV) Get

                                                                                                                                                                                                                                                                                                            func (obj ObjectV) Get(i interface{}) error

                                                                                                                                                                                                                                                                                                              Get implements the Value interface by decoding the underlying value to either a ObjectV or a native map type.

                                                                                                                                                                                                                                                                                                              func (ObjectV) MarshalJSON

                                                                                                                                                                                                                                                                                                              func (obj ObjectV) MarshalJSON() ([]byte, error)

                                                                                                                                                                                                                                                                                                                MarshalJSON implements json.Marshaler by escaping its value according to FaunaDB object representation.

                                                                                                                                                                                                                                                                                                                type OptionalParameter

                                                                                                                                                                                                                                                                                                                type OptionalParameter func(unescapedObj)

                                                                                                                                                                                                                                                                                                                  OptionalParameter describes optional parameters for query language functions

                                                                                                                                                                                                                                                                                                                  func After

                                                                                                                                                                                                                                                                                                                  func After(ref interface{}) OptionalParameter

                                                                                                                                                                                                                                                                                                                    After is an optional parameter used when cursoring that refers to the specified cursor's the next page, inclusive. For more information about pages, check https://fauna.com/documentation/queries#values-pages.

                                                                                                                                                                                                                                                                                                                    Functions that accept this optional parameter are: Paginate.

                                                                                                                                                                                                                                                                                                                    func Before

                                                                                                                                                                                                                                                                                                                    func Before(ref interface{}) OptionalParameter

                                                                                                                                                                                                                                                                                                                      Before is an optional parameter used when cursoring that refers to the specified cursor's previous page, exclusive. For more information about pages, check https://fauna.com/documentation/queries#values-pages.

                                                                                                                                                                                                                                                                                                                      Functions that accept this optional parameter are: Paginate.

                                                                                                                                                                                                                                                                                                                      func Default

                                                                                                                                                                                                                                                                                                                      func Default(value interface{}) OptionalParameter

                                                                                                                                                                                                                                                                                                                        Default is an optional parameter that specifies the default value for a select operation when the desired value path is absent.

                                                                                                                                                                                                                                                                                                                        Functions that accept this optional parameter are: Select.

                                                                                                                                                                                                                                                                                                                        func EventsOpt

                                                                                                                                                                                                                                                                                                                        func EventsOpt(events interface{}) OptionalParameter

                                                                                                                                                                                                                                                                                                                          EventsOpt is an boolean optional parameter that describes if the query should include historical events. For more information about events, check https://fauna.com/documentation/queries#values-events.

                                                                                                                                                                                                                                                                                                                          Functions that accept this optional parameter are: Paginate.

                                                                                                                                                                                                                                                                                                                          Deprecated: The Events function was renamed to EventsOpt to support the new history API. EventsOpt is provided here for backwards compatibility. Instead of using Paginate with the EventsOpt parameter, you should use the new Events function.

                                                                                                                                                                                                                                                                                                                          func Normalizer

                                                                                                                                                                                                                                                                                                                          func Normalizer(norm interface{}) OptionalParameter

                                                                                                                                                                                                                                                                                                                            Normalizer is a string optional parameter that specifies the normalization function for casefold operation.

                                                                                                                                                                                                                                                                                                                            Functions that accept this optional parameter are: Casefold.

                                                                                                                                                                                                                                                                                                                            func Separator

                                                                                                                                                                                                                                                                                                                            func Separator(sep interface{}) OptionalParameter

                                                                                                                                                                                                                                                                                                                              Separator is a string optional parameter that specifies the separator for a concat operation.

                                                                                                                                                                                                                                                                                                                              Functions that accept this optional parameter are: Concat.

                                                                                                                                                                                                                                                                                                                              func Size

                                                                                                                                                                                                                                                                                                                              func Size(size interface{}) OptionalParameter

                                                                                                                                                                                                                                                                                                                                Size is a numeric optional parameter that specifies the size of a pagination cursor.

                                                                                                                                                                                                                                                                                                                                Functions that accept this optional parameter are: Paginate.

                                                                                                                                                                                                                                                                                                                                func Sources

                                                                                                                                                                                                                                                                                                                                func Sources(sources interface{}) OptionalParameter

                                                                                                                                                                                                                                                                                                                                  Sources is a boolean optional parameter that specifies if a pagination cursor should include the source sets along with each element.

                                                                                                                                                                                                                                                                                                                                  Functions that accept this optional parameter are: Paginate.

                                                                                                                                                                                                                                                                                                                                  func TS

                                                                                                                                                                                                                                                                                                                                  func TS(timestamp interface{}) OptionalParameter

                                                                                                                                                                                                                                                                                                                                    TS is a timestamp optional parameter that specifies in which timestamp a query should be executed.

                                                                                                                                                                                                                                                                                                                                    Functions that accept this optional parameter are: Get, Insert, Remove, Exists, and Paginate.

                                                                                                                                                                                                                                                                                                                                    type PermissionDenied

                                                                                                                                                                                                                                                                                                                                    type PermissionDenied struct{ FaunaError }

                                                                                                                                                                                                                                                                                                                                      A PermissionDenied wraps an HTTP 403 error response.

                                                                                                                                                                                                                                                                                                                                      type QueryError

                                                                                                                                                                                                                                                                                                                                      type QueryError struct {
                                                                                                                                                                                                                                                                                                                                      	Position    []string            `fauna:"position"`
                                                                                                                                                                                                                                                                                                                                      	Code        string              `fauna:"code"`
                                                                                                                                                                                                                                                                                                                                      	Description string              `fauna:"description"`
                                                                                                                                                                                                                                                                                                                                      	Failures    []ValidationFailure `fauna:"failures"`
                                                                                                                                                                                                                                                                                                                                      }

                                                                                                                                                                                                                                                                                                                                        QueryError describes query errors returned by the server.

                                                                                                                                                                                                                                                                                                                                        type QueryV

                                                                                                                                                                                                                                                                                                                                        type QueryV struct {
                                                                                                                                                                                                                                                                                                                                        	// contains filtered or unexported fields
                                                                                                                                                                                                                                                                                                                                        }

                                                                                                                                                                                                                                                                                                                                          QueryV represents a `@query` value in FaunaDB.

                                                                                                                                                                                                                                                                                                                                          func (QueryV) At

                                                                                                                                                                                                                                                                                                                                          func (query QueryV) At(field Field) FieldValue

                                                                                                                                                                                                                                                                                                                                            At implements the Value interface by returning an invalid field since QueryV is not transversable.

                                                                                                                                                                                                                                                                                                                                            func (QueryV) Get

                                                                                                                                                                                                                                                                                                                                            func (query QueryV) Get(i interface{}) error

                                                                                                                                                                                                                                                                                                                                              Get implements the Value interface by decoding the underlying value to a QueryV.

                                                                                                                                                                                                                                                                                                                                              func (QueryV) MarshalJSON

                                                                                                                                                                                                                                                                                                                                              func (query QueryV) MarshalJSON() ([]byte, error)

                                                                                                                                                                                                                                                                                                                                                MarshalJSON implements json.Marshaler by escaping its value according to FaunaDB query representation.

                                                                                                                                                                                                                                                                                                                                                type RefV

                                                                                                                                                                                                                                                                                                                                                type RefV struct {
                                                                                                                                                                                                                                                                                                                                                	ID       string
                                                                                                                                                                                                                                                                                                                                                	Class    *RefV
                                                                                                                                                                                                                                                                                                                                                	Database *RefV
                                                                                                                                                                                                                                                                                                                                                }

                                                                                                                                                                                                                                                                                                                                                  RefV represents a FaunaDB ref type.

                                                                                                                                                                                                                                                                                                                                                  func NativeClasses

                                                                                                                                                                                                                                                                                                                                                  func NativeClasses() *RefV

                                                                                                                                                                                                                                                                                                                                                  func NativeCredentials

                                                                                                                                                                                                                                                                                                                                                  func NativeCredentials() *RefV

                                                                                                                                                                                                                                                                                                                                                  func NativeDatabases

                                                                                                                                                                                                                                                                                                                                                  func NativeDatabases() *RefV

                                                                                                                                                                                                                                                                                                                                                  func NativeFunctions

                                                                                                                                                                                                                                                                                                                                                  func NativeFunctions() *RefV

                                                                                                                                                                                                                                                                                                                                                  func NativeIndexes

                                                                                                                                                                                                                                                                                                                                                  func NativeIndexes() *RefV

                                                                                                                                                                                                                                                                                                                                                  func NativeKeys

                                                                                                                                                                                                                                                                                                                                                  func NativeKeys() *RefV

                                                                                                                                                                                                                                                                                                                                                  func NativeTokens

                                                                                                                                                                                                                                                                                                                                                  func NativeTokens() *RefV

                                                                                                                                                                                                                                                                                                                                                  func (RefV) At

                                                                                                                                                                                                                                                                                                                                                  func (ref RefV) At(field Field) FieldValue

                                                                                                                                                                                                                                                                                                                                                    At implements the Value interface by returning an invalid field since RefV is not transversable.

                                                                                                                                                                                                                                                                                                                                                    func (RefV) Get

                                                                                                                                                                                                                                                                                                                                                    func (ref RefV) Get(i interface{}) error

                                                                                                                                                                                                                                                                                                                                                      Get implements the Value interface by decoding the underlying ref to a RefV.

                                                                                                                                                                                                                                                                                                                                                      func (RefV) MarshalJSON

                                                                                                                                                                                                                                                                                                                                                      func (ref RefV) MarshalJSON() ([]byte, error)

                                                                                                                                                                                                                                                                                                                                                        MarshalJSON implements json.Marshaler by escaping its value according to FaunaDB ref representation.

                                                                                                                                                                                                                                                                                                                                                        type SetRefV

                                                                                                                                                                                                                                                                                                                                                        type SetRefV struct {
                                                                                                                                                                                                                                                                                                                                                        	Parameters map[string]Value
                                                                                                                                                                                                                                                                                                                                                        }

                                                                                                                                                                                                                                                                                                                                                          SetRefV represents a FaunaDB setref type.

                                                                                                                                                                                                                                                                                                                                                          func (SetRefV) At

                                                                                                                                                                                                                                                                                                                                                          func (set SetRefV) At(field Field) FieldValue

                                                                                                                                                                                                                                                                                                                                                            At implements the Value interface by returning an invalid field since SetRefV is not transversable.

                                                                                                                                                                                                                                                                                                                                                            func (SetRefV) Get

                                                                                                                                                                                                                                                                                                                                                            func (set SetRefV) Get(i interface{}) error

                                                                                                                                                                                                                                                                                                                                                              Get implements the Value interface by decoding the underlying value to a SetRefV.

                                                                                                                                                                                                                                                                                                                                                              func (SetRefV) MarshalJSON

                                                                                                                                                                                                                                                                                                                                                              func (set SetRefV) MarshalJSON() ([]byte, error)

                                                                                                                                                                                                                                                                                                                                                                MarshalJSON implements json.Marshaler by escaping its value according to FaunaDB setref representation.

                                                                                                                                                                                                                                                                                                                                                                type StringV

                                                                                                                                                                                                                                                                                                                                                                type StringV string

                                                                                                                                                                                                                                                                                                                                                                  StringV represents a valid JSON string.

                                                                                                                                                                                                                                                                                                                                                                  func (StringV) At

                                                                                                                                                                                                                                                                                                                                                                  func (str StringV) At(field Field) FieldValue

                                                                                                                                                                                                                                                                                                                                                                    At implements the Value interface by returning an invalid field since StringV is not transversable.

                                                                                                                                                                                                                                                                                                                                                                    func (StringV) Get

                                                                                                                                                                                                                                                                                                                                                                    func (str StringV) Get(i interface{}) error

                                                                                                                                                                                                                                                                                                                                                                      Get implements the Value interface by decoding the underlying value to either a StringV or a string type.

                                                                                                                                                                                                                                                                                                                                                                      type TimeV

                                                                                                                                                                                                                                                                                                                                                                      type TimeV time.Time

                                                                                                                                                                                                                                                                                                                                                                        TimeV represents a FaunaDB time type.

                                                                                                                                                                                                                                                                                                                                                                        func (TimeV) At

                                                                                                                                                                                                                                                                                                                                                                        func (localTime TimeV) At(field Field) FieldValue

                                                                                                                                                                                                                                                                                                                                                                          At implements the Value interface by returning an invalid field since TimeV is not transversable.

                                                                                                                                                                                                                                                                                                                                                                          func (TimeV) Get

                                                                                                                                                                                                                                                                                                                                                                          func (localTime TimeV) Get(i interface{}) error

                                                                                                                                                                                                                                                                                                                                                                            Get implements the Value interface by decoding the underlying value to either a TimeV or a time.Time type.

                                                                                                                                                                                                                                                                                                                                                                            func (TimeV) MarshalJSON

                                                                                                                                                                                                                                                                                                                                                                            func (localTime TimeV) MarshalJSON() ([]byte, error)

                                                                                                                                                                                                                                                                                                                                                                              MarshalJSON implements json.Marshaler by escaping its value according to FaunaDB time representation.

                                                                                                                                                                                                                                                                                                                                                                              type Unauthorized

                                                                                                                                                                                                                                                                                                                                                                              type Unauthorized struct{ FaunaError }

                                                                                                                                                                                                                                                                                                                                                                                A Unauthorized wraps an HTTP 401 error response.

                                                                                                                                                                                                                                                                                                                                                                                type Unavailable

                                                                                                                                                                                                                                                                                                                                                                                type Unavailable struct{ FaunaError }

                                                                                                                                                                                                                                                                                                                                                                                  A Unavailable wraps an HTTP 503 error response.

                                                                                                                                                                                                                                                                                                                                                                                  type UnknownError

                                                                                                                                                                                                                                                                                                                                                                                  type UnknownError struct{ FaunaError }

                                                                                                                                                                                                                                                                                                                                                                                    A UnknownError wraps any unknown http error response.

                                                                                                                                                                                                                                                                                                                                                                                    type ValidationFailure

                                                                                                                                                                                                                                                                                                                                                                                    type ValidationFailure struct {
                                                                                                                                                                                                                                                                                                                                                                                    	Field       []string `fauna:"field"`
                                                                                                                                                                                                                                                                                                                                                                                    	Code        string   `fauna:"code"`
                                                                                                                                                                                                                                                                                                                                                                                    	Description string   `fauna:"description"`
                                                                                                                                                                                                                                                                                                                                                                                    }

                                                                                                                                                                                                                                                                                                                                                                                      ValidationFailure describes validation errors on a submitted query.

                                                                                                                                                                                                                                                                                                                                                                                      type Value

                                                                                                                                                                                                                                                                                                                                                                                      type Value interface {
                                                                                                                                                                                                                                                                                                                                                                                      	Expr
                                                                                                                                                                                                                                                                                                                                                                                      	Get(interface{}) error // Decode a FaunaDB value into a native Go type
                                                                                                                                                                                                                                                                                                                                                                                      	At(Field) FieldValue   // Transverse the value using the field extractor informed
                                                                                                                                                                                                                                                                                                                                                                                      }

                                                                                                                                                                                                                                                                                                                                                                                        Value represents valid FaunaDB values returned from the server. Values also implement the Expr interface. They can be sent back and forth to FaunaDB with no extra escaping needed.

                                                                                                                                                                                                                                                                                                                                                                                        The Get method is used to decode a FaunaDB value into a Go type. For example:

                                                                                                                                                                                                                                                                                                                                                                                        var t time.Time
                                                                                                                                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                                                                                                                        faunaTime, _ := client.Query(Time("now"))
                                                                                                                                                                                                                                                                                                                                                                                        _ := faunaTime.Get(&t)
                                                                                                                                                                                                                                                                                                                                                                                        

                                                                                                                                                                                                                                                                                                                                                                                        The At method uses field extractors to transverse the data to specify a field:

                                                                                                                                                                                                                                                                                                                                                                                        var firstEmail string
                                                                                                                                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                                                                                                                        profile, _ := client.Query(Ref("classes/profile/43"))
                                                                                                                                                                                                                                                                                                                                                                                        profile.At(ObjKey("emails").AtIndex(0)).Get(&firstEmail)
                                                                                                                                                                                                                                                                                                                                                                                        

                                                                                                                                                                                                                                                                                                                                                                                        For more information, check https://fauna.com/documentation/queries#values.

                                                                                                                                                                                                                                                                                                                                                                                        type ValueNotFound

                                                                                                                                                                                                                                                                                                                                                                                        type ValueNotFound struct {
                                                                                                                                                                                                                                                                                                                                                                                        	// contains filtered or unexported fields
                                                                                                                                                                                                                                                                                                                                                                                        }

                                                                                                                                                                                                                                                                                                                                                                                          ValueNotFound describes an error can occur when trying to extract a field, but that field could not be found.

                                                                                                                                                                                                                                                                                                                                                                                          func (ValueNotFound) Error

                                                                                                                                                                                                                                                                                                                                                                                          func (v ValueNotFound) Error() string