constant

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 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 Constant

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

type Log

type Log string // Always "log"

func (Log) Default

func (c Log) Default() Log

func (Log) MarshalJSON

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

type State

type State string // Always "state"

func (State) Default

func (c State) Default() State

func (State) MarshalJSON

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

type StateUpdate

type StateUpdate string // Always "state_update"

func (StateUpdate) Default

func (c StateUpdate) Default() StateUpdate

func (StateUpdate) MarshalJSON

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

Jump to

Keyboard shortcuts

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