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 ¶
- Variables
- type Boolean
- func (v Boolean) Bool() bool
- func (v Boolean) CollectInto(col schema.ScalarCollector)
- func (v *Boolean) FromLiteralValue(l schema.LiteralValue) error
- func (v Boolean) MarshalJSON() ([]byte, error)
- func (v Boolean) Nil() bool
- func (v *Boolean) Scan(src interface{}) error
- func (v Boolean) ToLiteralValue() (schema.LiteralValue, error)
- func (v *Boolean) UnmarshalJSON(data []byte) error
- type Float
- func (v Float) CollectInto(col schema.ScalarCollector)
- func (v Float) Float64() float64
- func (v *Float) FromLiteralValue(l schema.LiteralValue) error
- func (v Float) MarshalJSON() ([]byte, error)
- func (v Float) Nil() bool
- func (v *Float) Scan(src interface{}) error
- func (v Float) ToLiteralValue() (schema.LiteralValue, error)
- func (v *Float) UnmarshalJSON(data []byte) error
- type ID
- type Int
- func (v Int) CollectInto(col schema.ScalarCollector)
- func (v *Int) FromLiteralValue(l schema.LiteralValue) error
- func (v Int) Int32() int32
- func (v Int) MarshalJSON() ([]byte, error)
- func (v Int) Nil() bool
- func (v *Int) Scan(src interface{}) error
- func (v Int) ToLiteralValue() (schema.LiteralValue, error)
- func (v *Int) UnmarshalJSON(data []byte) error
- type String
- func (v String) CollectInto(col schema.ScalarCollector)
- func (v *String) FromLiteralValue(l schema.LiteralValue) error
- func (v String) MarshalJSON() ([]byte, error)
- func (v String) Nil() bool
- func (v *String) Scan(src interface{}) error
- func (v String) String() string
- func (v String) ToLiteralValue() (schema.LiteralValue, error)
- func (v *String) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
var PermissiveInputCallback = func(typ string, value schema.LiteralValue) {}
PermissiveInputCallback is a callback that is notified when a value is accepted via permissive parsing
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 (Boolean) 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 ¶
MarshalJSON implements json.Marshaler
func (Boolean) ToLiteralValue ¶
func (v Boolean) ToLiteralValue() (schema.LiteralValue, error)
ToLiteralValue converts this value to a schema.LiteralValue
func (*Boolean) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler
type Float ¶
type Float struct {
// contains filtered or unexported fields
}
Float represents the GraphQL built in Float type
func (Float) CollectInto ¶
func (v Float) CollectInto(col schema.ScalarCollector)
CollectInto implements schema.CollectableScalar
func (Float) 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 ¶
MarshalJSON implements json.Marshaler
func (Float) ToLiteralValue ¶
func (v Float) ToLiteralValue() (schema.LiteralValue, error)
ToLiteralValue converts this value to a schema.LiteralValue
func (*Float) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
ID represents the GraphQL built in ID type
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) 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 (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) MarshalJSON ¶
MarshalJSON implements json.Marshaler
func (Int) ToLiteralValue ¶
func (v Int) ToLiteralValue() (schema.LiteralValue, error)
ToLiteralValue converts this value to a schema.LiteralValue
func (*Int) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler
type String ¶
type String struct {
// contains filtered or unexported fields
}
String represents the GraphQL built in String type
func NewStringNilEmpty ¶
NewStringNilEmpty makes a new string, mapping "" to the nil value
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 ¶
MarshalJSON implements json.Marshaler
func (String) ToLiteralValue ¶
func (v String) ToLiteralValue() (schema.LiteralValue, error)
ToLiteralValue converts this value to a schema.LiteralValue
func (*String) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler