runtime

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDecoder added in v1.7.0

func GetDecoder(reader io.Reader) *nexemab.Decoder

GetDecoder retrieves a nexemab.Decoder instance

func GetEncoder added in v1.7.0

func GetEncoder() *nexemab.Encoder

GetEncoder retrieves a nexemab.Encoder instance

Types

type NexemaType added in v1.7.0

type NexemaType struct {
	NoCopy
}

NexemaType represents the base struct for any Nexema's type. This is not meant to be used at runtime

type Nexemable added in v1.7.0

type Nexemable interface {
	Encode() ([]byte, error)
	MustEncode() []byte

	Decode(reader io.Reader) error
	MustDecode(reader io.Reader)
	MergeUsing(other Nexemable) error
	MergeFrom(buffer []byte) error
	Clone() Nexemable
}

Nexemable interface provides methods to serialize and deserialize an struct to/from nexemab. Any struct which implements this interface becomes a Nexemable type.

type NoCopy added in v1.7.0

type NoCopy [0]sync.Mutex

noCopy may be embedded into structs which must not be copied after the first use.

See https://golang.org/issues/8005#issuecomment-190753527 for details.

type Nullable

type Nullable[T any] struct {
	Value *T
}

Nullable represents T but allowing to set it as "null"

func NewNull

func NewNull[T any]() Nullable[T]

NewNull creates a new Nullable[T] without a value

func NewNullable

func NewNullable[T any](v T) Nullable[T]

NewNullalbe creates a new Nullable[T] setting its value to the pointer of v

func (*Nullable[T]) Clear added in v1.7.0

func (n *Nullable[T]) Clear()

Clear clears the underlying value, setting it as null

func (*Nullable[T]) IsNull

func (n *Nullable[T]) IsNull() bool

IsNull returns true if the current nullable does not have a value

func (*Nullable[T]) SetValue

func (n *Nullable[T]) SetValue(v T)

SetValues sets the value of the nullable

func (Nullable[T]) String added in v1.7.0

func (n Nullable[T]) String() string

func (*Nullable[T]) ValueOrZero

func (n *Nullable[T]) ValueOrZero() T

ValueOrZero returns a zero value of T if its null, otherwise, its actual value.

Jump to

Keyboard shortcuts

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