scalars

package
v0.0.0-...-1fa5987 Latest Latest
Warning

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

Go to latest
Published: May 14, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

TODO: Expose this package in the SDK.

Index

Constants

This section is empty.

Variables

View Source
var InfiniteULID = ULID{
	0xFF, 0xFF, 0xFF, 0xFF,
	0xFF, 0xFF, 0xFF, 0xFF,
	0xFF, 0xFF, 0xFF, 0xFF,
	0xFF, 0xFF, 0xFF, 0xFF,
}

Greater than any valid ULID.

Functions

func DecodeStruct

func DecodeStruct(input, output any) error

Types

type CueValue

type CueValue cue.Value

func EncodeCueValue

func EncodeCueValue(v any) CueValue

func (CueValue) Bytes

func (cv CueValue) Bytes() []byte

func (CueValue) ImplementsGraphQLType

func (_ CueValue) ImplementsGraphQLType(name string) bool

func (CueValue) MarshalJSON

func (cv CueValue) MarshalJSON() ([]byte, error)

func (*CueValue) Scan

func (cv *CueValue) Scan(src any) error

func (CueValue) String

func (cv CueValue) String() string

func (*CueValue) UnmarshalGraphQL

func (cv *CueValue) UnmarshalGraphQL(input any) (err error)

func (*CueValue) UnmarshalJSON

func (cv *CueValue) UnmarshalJSON(bs []byte) error

func (CueValue) Value

func (cv CueValue) Value() (driver.Value, error)

type DatabaseScalar

type DatabaseScalar interface {
	sql.Scanner
	driver.Valuer
}

type GraphQLScalar

type GraphQLScalar interface {
	graphql.Unmarshaler

	json.Marshaler
	json.Unmarshaler
}

type Instant

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

func GoTimeToInstant

func GoTimeToInstant(t time.Time) Instant

func Now

func Now(ctx context.Context) Instant

func (Instant) After

func (inst Instant) After(other Instant) bool

func (Instant) Before

func (inst Instant) Before(other Instant) bool

func (Instant) Equal

func (inst Instant) Equal(other Instant) bool

func (Instant) GoTime

func (inst Instant) GoTime() time.Time

func (Instant) ImplementsGraphQLType

func (_ Instant) ImplementsGraphQLType(name string) bool

func (Instant) MarshalJSON

func (inst Instant) MarshalJSON() ([]byte, error)

func (*Instant) Scan

func (inst *Instant) Scan(src any) error

func (Instant) String

func (inst Instant) String() string

func (Instant) Sub

func (inst Instant) Sub(other Instant) time.Duration

func (Instant) UnixMilli

func (inst Instant) UnixMilli() int64

func (*Instant) UnmarshalGraphQL

func (inst *Instant) UnmarshalGraphQL(input any) (err error)

func (*Instant) UnmarshalJSON

func (inst *Instant) UnmarshalJSON(bs []byte) (err error)

func (Instant) Value

func (inst Instant) Value() (driver.Value, error)

type JSONObject

type JSONObject map[string]any

JSON scalar for values known to be map-like objects. Marshals to and from the database as an encoded JSON string, but marshals to and from GraphQL as plain JSON-values, avoiding double-encoding.

func (JSONObject) ImplementsGraphQLType

func (_ JSONObject) ImplementsGraphQLType(name string) bool

func (JSONObject) MarshalJSON

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

func (*JSONObject) Scan

func (obj *JSONObject) Scan(src any) error

func (*JSONObject) UnmarshalGraphQL

func (obj *JSONObject) UnmarshalGraphQL(input any) (err error)

func (*JSONObject) UnmarshalJSON

func (obj *JSONObject) UnmarshalJSON(bs []byte) (err error)

func (JSONObject) Value

func (obj JSONObject) Value() (driver.Value, error)

type RawJSON

type RawJSON []byte

JSON scalar with json.RawMessage style unmarshaling behavior.

func (RawJSON) MarshalJSON

func (raw RawJSON) MarshalJSON() ([]byte, error)

Same as json.RawMessage.MarshalJSON.

func (*RawJSON) Scan

func (raw *RawJSON) Scan(src any) error

func (*RawJSON) UnmarshalJSON

func (raw *RawJSON) UnmarshalJSON(data []byte) error

Same as json.RawMessage.UnmarshalJSON.

func (RawJSON) Value

func (raw RawJSON) Value() (driver.Value, error)

type Scalar

type Scalar interface {
	GraphQLScalar
	DatabaseScalar
}

type ULID

type ULID [16]byte

func IncrementULID

func IncrementULID(id ULID) ULID

func InstantToULID

func InstantToULID(inst Instant) ULID

func ULIDMax

func ULIDMax(a, b ULID) ULID

func ULIDMin

func ULIDMin(a, b ULID) ULID

func (ULID) ImplementsGraphQLType

func (_ ULID) ImplementsGraphQLType(name string) bool

func (ULID) MarshalJSON

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

func (*ULID) Scan

func (u *ULID) Scan(src any) error

func (ULID) String

func (u ULID) String() string

func (ULID) Timestamp

func (u ULID) Timestamp() Instant

func (*ULID) UnmarshalGraphQL

func (u *ULID) UnmarshalGraphQL(input any) error

func (ULID) UnmarshalJSON

func (u ULID) UnmarshalJSON(bs []byte) (err error)

func (ULID) Value

func (u ULID) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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