scalar

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BigInt

type BigInt int64

BigInt wraps the scalar implementation for big integer, with string representation

@scalar BigInt string.

func NewBigInt

func NewBigInt(value int64) BigInt

NewBigInt creates a BigInt instance.

func (*BigInt) FromValue

func (bi *BigInt) FromValue(value any) error

FromValue decode any value to Int64.

func (BigInt) MarshalJSON

func (bi BigInt) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (BigInt) ScalarName

func (bi BigInt) ScalarName() string

ScalarName get the schema name of the scalar.

func (BigInt) String

func (bi BigInt) String() string

Stringer implements fmt.Stringer interface.

func (*BigInt) UnmarshalJSON

func (bi *BigInt) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Bytes

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

Bytes wraps the scalar implementation for bytes with base64 encoding

@scalar Bytes string.

func NewBytes

func NewBytes(data []byte) *Bytes

NewBytes create a Bytes instance.

func ParseBytes

func ParseBytes(value string) (*Bytes, error)

ParseBytes parses bytes from base64 string.

func (Bytes) Bytes

func (bs Bytes) Bytes() []byte

Bytes get the inner bytes value.

func (*Bytes) FromValue

func (bs *Bytes) FromValue(value any) error

FromValue decode any value to d Date.

func (Bytes) Len

func (bs Bytes) Len() int

Bytes get the inner bytes length.

func (Bytes) MarshalJSON

func (bs Bytes) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (Bytes) ScalarName

func (bs Bytes) ScalarName() string

ScalarName get the schema name of the scalar.

func (Bytes) String

func (bs Bytes) String() string

String implements fmt.Stringer interface.

func (*Bytes) UnmarshalJSON

func (bs *Bytes) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Date

type Date struct {
	time.Time
}

Date wraps the scalar implementation for date representation string

@scalar Date date.

func NewDate

func NewDate(year int, month time.Month, day int) *Date

NewDate creates a date instance.

func ParseDate

func ParseDate(value string) (*Date, error)

ParseDate parses a date from string.

func (*Date) FromValue

func (d *Date) FromValue(value any) error

FromValue decode any value to d Date.

func (Date) MarshalJSON

func (d Date) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (Date) ScalarName

func (d Date) ScalarName() string

ScalarName get the schema name of the scalar.

func (Date) String

func (d Date) String() string

Stringer implements fmt.Stringer interface.

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Duration added in v1.6.0

type Duration struct {
	time.Duration
}

Decimal wraps the scalar implementation for duration, with string or unix time integer in nanoseconds

@scalar Duration

func NewDuration added in v1.6.0

func NewDuration(value time.Duration) Duration

NewDuration creates a Duration instance

func (*Duration) FromValue added in v1.6.0

func (d *Duration) FromValue(value any) error

FromValue decode any value to Duration.

func (Duration) MarshalJSON added in v1.6.0

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (Duration) ScalarName added in v1.6.0

func (d Duration) ScalarName() string

ScalarName get the schema name of the scalar.

func (Duration) String added in v1.6.0

func (d Duration) String() string

Stringer implements fmt.Stringer interface.

func (*Duration) UnmarshalJSON added in v1.6.0

func (d *Duration) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type URL

type URL struct {
	*url.URL
}

URL represents a URL string

@scalar URL string.

func NewURL

func NewURL(rawURL string) (*URL, error)

NewURL creates a URL instance.

func (*URL) FromValue

func (u *URL) FromValue(value any) error

FromValue decode any value to URL.

func (URL) MarshalJSON

func (u URL) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (URL) ScalarName

func (j URL) ScalarName() string

ScalarName get the schema name of the scalar.

func (URL) String

func (u URL) String() string

Stringer implements fmt.Stringer interface.

func (*URL) UnmarshalJSON

func (u *URL) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

Jump to

Keyboard shortcuts

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