scalar

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID[T any] struct {
	Value T
}

ID represents GraphQL's "ID" scalar type. A custom type may be used instead.

func NewID

func NewID[T any](v T) ID[T]

func (ID[T]) ImplementsGraphQLType

func (ID[T]) ImplementsGraphQLType(name string) bool

func (ID[T]) MarshalJSON

func (id ID[T]) MarshalJSON() ([]byte, error)

func (*ID[T]) UnmarshalGraphQL

func (id *ID[T]) UnmarshalGraphQL(v any) error

type NullBool

type NullBool struct {
	Value *bool
	Set   bool
}

NullBool is a boolean that can be null. Use it in input structs to differentiate a value explicitly set to null from an omitted value. When the value is defined (either null or a value) Set is true.

func (NullBool) ImplementsGraphQLType

func (NullBool) ImplementsGraphQLType(name string) bool

func (*NullBool) Nullable

func (s *NullBool) Nullable()

func (*NullBool) UnmarshalGraphQL

func (s *NullBool) UnmarshalGraphQL(input interface{}) error

type NullFloat

type NullFloat struct {
	Value *float64
	Set   bool
}

NullFloat is a float that can be null. Use it in input structs to differentiate a value explicitly set to null from an omitted value. When the value is defined (either null or a value) Set is true.

func (NullFloat) ImplementsGraphQLType

func (NullFloat) ImplementsGraphQLType(name string) bool

func (*NullFloat) Nullable

func (s *NullFloat) Nullable()

func (*NullFloat) UnmarshalGraphQL

func (s *NullFloat) UnmarshalGraphQL(input interface{}) error

type NullID

type NullID[T any] struct {
	Value *ID[T]
	Set   bool
}

NullID is an ID that can be null. Use it in input structs to differentiate a value explicitly set to null from an omitted value. When the value is defined (either null or a value) Set is true.

func (NullID[T]) ImplementsGraphQLType

func (NullID[T]) ImplementsGraphQLType(name string) bool

func (*NullID[T]) Nullable

func (s *NullID[T]) Nullable()

func (*NullID[T]) UnmarshalGraphQL

func (s *NullID[T]) UnmarshalGraphQL(input interface{}) error

type NullInt

type NullInt struct {
	Value *int32
	Set   bool
}

NullInt is an int that can be null. Use it in input structs to differentiate a value explicitly set to null from an omitted value. When the value is defined (either null or a value) Set is true.

func (NullInt) ImplementsGraphQLType

func (NullInt) ImplementsGraphQLType(name string) bool

func (*NullInt) Nullable

func (s *NullInt) Nullable()

func (*NullInt) UnmarshalGraphQL

func (s *NullInt) UnmarshalGraphQL(input interface{}) error

type NullString

type NullString struct {
	Value *string
	Set   bool
}

NullString is a string that can be null. Use it in input structs to differentiate a value explicitly set to null from an omitted value. When the value is defined (either null or a value) Set is true.

func (NullString) ImplementsGraphQLType

func (NullString) ImplementsGraphQLType(name string) bool

func (*NullString) Nullable

func (s *NullString) Nullable()

func (*NullString) UnmarshalGraphQL

func (s *NullString) UnmarshalGraphQL(input interface{}) error

type NullTime

type NullTime struct {
	Value *Time
	Set   bool
}

NullTime is a time value that can be null. Use it in input structs to differentiate a value explicitly set to null from an omitted value. When the value is defined (either null or a value) Set is true.

func (NullTime) ImplementsGraphQLType

func (NullTime) ImplementsGraphQLType(name string) bool

func (*NullTime) Nullable

func (s *NullTime) Nullable()

func (*NullTime) UnmarshalGraphQL

func (s *NullTime) UnmarshalGraphQL(input interface{}) error

type Time

type Time struct {
	time.Time
}

Time is a custom GraphQL type to represent an instant in time. It has to be added to a schema via "scalar Time" since it is not a predeclared GraphQL type like "ID".

func (Time) ImplementsGraphQLType

func (Time) ImplementsGraphQLType(name string) bool

ImplementsGraphQLType maps this custom Go type to the graphql scalar type in the schema.

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON is a custom marshaler for Time

This function will be called whenever you query for fields that use the Time type

func (*Time) UnmarshalGraphQL

func (t *Time) UnmarshalGraphQL(input interface{}) error

UnmarshalGraphQL is a custom unmarshaler for Time

This function will be called whenever you use the time scalar as an input

Jump to

Keyboard shortcuts

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