types

package
v0.0.0-...-02cfa7b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2023 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Overview

Package types provides implementations of all GraphQL built in types.

As a convenience, the types in this package are Scannable from SQL and Unmarshalable from JSON (as well as providing fast unmarhshalling via jsoniter) so that they can be used to directly map data from a database or JSON speaking service.

Index

Constants

This section is empty.

Variables

View Source
var PermissiveInputCallback = func(typ string, value schema.LiteralValue) {}

PermissiveInputCallback is a callback that is notified when a value is accepted via permissive parsing

View Source
var PermissiveInputParsing = false

PermissiveInputParsing allows more input value conversions than allowed by the spec if set to true

Functions

This section is empty.

Types

type Boolean

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

Boolean represents the GraphQL built in Boolean type

func NewBoolean

func NewBoolean(v bool) Boolean

NewBoolean makes a new bool

func NilBoolean

func NilBoolean() Boolean

NilBoolean makes a nil bool

func (Boolean) Bool

func (v Boolean) Bool() bool

Bool returns the value of this scalar as a bool. If v is nil, false is returned.

func (Boolean) CollectInto

func (v Boolean) CollectInto(col schema.ScalarCollector)

CollectInto implements schema.CollectableScalar

func (*Boolean) FromLiteralValue

func (v *Boolean) FromLiteralValue(l schema.LiteralValue) error

FromLiteralValue populates this value from a schema.LiteralValue

func (Boolean) MarshalJSON

func (v Boolean) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (Boolean) Nil

func (v Boolean) Nil() bool

Nil returns whether this scalar is nil

func (*Boolean) Scan

func (v *Boolean) Scan(src interface{}) error

Scan implements sql.Scanner

func (Boolean) ToLiteralValue

func (v Boolean) ToLiteralValue() (schema.LiteralValue, error)

ToLiteralValue converts this value to a schema.LiteralValue

func (*Boolean) UnmarshalJSON

func (v *Boolean) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type Float

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

Float represents the GraphQL built in Float type

func NewFloat

func NewFloat(v float64) Float

NewFloat makes a new float

func NilFloat

func NilFloat() Float

NilFloat makes a nil float

func (Float) CollectInto

func (v Float) CollectInto(col schema.ScalarCollector)

CollectInto implements schema.CollectableScalar

func (Float) Float64

func (v Float) Float64() float64

Float64 returns the value of this scalar as a float64. If v is nil, 0 is returned.

func (*Float) FromLiteralValue

func (v *Float) FromLiteralValue(l schema.LiteralValue) error

FromLiteralValue populates this value from a schema.LiteralValue

func (Float) MarshalJSON

func (v Float) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (Float) Nil

func (v Float) Nil() bool

Nil returns whether this scalar is nil

func (*Float) Scan

func (v *Float) Scan(src interface{}) error

Scan implements sql.Scanner

func (Float) ToLiteralValue

func (v Float) ToLiteralValue() (schema.LiteralValue, error)

ToLiteralValue converts this value to a schema.LiteralValue

func (*Float) UnmarshalJSON

func (v *Float) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type ID

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

ID represents the GraphQL built in ID type

func NewID

func NewID(v string) ID

NewID creates a new ID

func NilID

func NilID() ID

NilID creates a nil ID

func (ID) CollectInto

func (v ID) CollectInto(col schema.ScalarCollector)

CollectInto implements schema.CollectableScalar

func (*ID) FromLiteralValue

func (v *ID) FromLiteralValue(l schema.LiteralValue) error

FromLiteralValue populates this value from a schema.LiteralValue

func (ID) Nil

func (v ID) Nil() bool

Nil returns whether this scalar is nil

func (*ID) Scan

func (v *ID) Scan(src interface{}) error

Scan implements sql.Scanner

func (ID) String

func (v ID) String() string

String returns the raw value of this scalar as a string

func (ID) ToLiteralValue

func (v ID) ToLiteralValue() (schema.LiteralValue, error)

ToLiteralValue converts this value to a schema.LiteralValue

type Int

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

Int represents the GraphQL built in Int type

func NewInt

func NewInt(v int32) Int

NewInt makes a new int

func NilInt

func NilInt() Int

NilInt makes a nil int

func (Int) CollectInto

func (v Int) CollectInto(col schema.ScalarCollector)

CollectInto implements schema.CollectableScalar

func (*Int) FromLiteralValue

func (v *Int) FromLiteralValue(l schema.LiteralValue) error

FromLiteralValue populates this value from a schema.LiteralValue

func (Int) Int32

func (v Int) Int32() int32

Int32 returns the value of this scalar as an int32. If v is nil, 0 is returned.

func (Int) MarshalJSON

func (v Int) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (Int) Nil

func (v Int) Nil() bool

Nil returns whether this scalar is nil

func (*Int) Scan

func (v *Int) Scan(src interface{}) error

Scan implements sql.Scanner

func (Int) ToLiteralValue

func (v Int) ToLiteralValue() (schema.LiteralValue, error)

ToLiteralValue converts this value to a schema.LiteralValue

func (*Int) UnmarshalJSON

func (v *Int) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type String

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

String represents the GraphQL built in String type

func NewString

func NewString(v string) String

NewString makes a new string

func NewStringNilEmpty

func NewStringNilEmpty(v string) String

NewStringNilEmpty makes a new string, mapping "" to the nil value

func NilString

func NilString() String

NilString makes a nil string

func (String) CollectInto

func (v String) CollectInto(col schema.ScalarCollector)

CollectInto implements schema.CollectableScalar

func (*String) FromLiteralValue

func (v *String) FromLiteralValue(l schema.LiteralValue) error

FromLiteralValue populates this value from a schema.LiteralValue

func (String) MarshalJSON

func (v String) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (String) Nil

func (v String) Nil() bool

Nil returns whether this scalar is nil

func (*String) Scan

func (v *String) Scan(src interface{}) error

Scan implements sql.Scanner

func (String) String

func (v String) String() string

String returns the string value. If v is nil, "" is returned.

func (String) ToLiteralValue

func (v String) ToLiteralValue() (schema.LiteralValue, error)

ToLiteralValue converts this value to a schema.LiteralValue

func (*String) UnmarshalJSON

func (v *String) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL