constant

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValueOf

func ValueOf[T Constant[T]]() T

ValueOf gives the default value of a constant from its type. It's helpful when constructing constants as variants in a one-of. Note that empty structs are marshalled by default. Usage: constant.ValueOf[constant.Foo]()

Types

type Completed

type Completed string // Always "completed"

func (Completed) Default

func (c Completed) Default() Completed

func (Completed) MarshalJSON

func (c Completed) MarshalJSON() ([]byte, error)

type Constant

type Constant[T any] interface {
	Default() T
}

type InProgress

type InProgress string // Always "in_progress"

func (InProgress) Default

func (c InProgress) Default() InProgress

func (InProgress) MarshalJSON

func (c InProgress) MarshalJSON() ([]byte, error)

type NotStarted

type NotStarted string // Always "not_started"

func (NotStarted) Default

func (c NotStarted) Default() NotStarted

func (NotStarted) MarshalJSON

func (c NotStarted) MarshalJSON() ([]byte, error)

type Queued

type Queued string // Always "queued"

func (Queued) Default

func (c Queued) Default() Queued

func (Queued) MarshalJSON

func (c Queued) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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