Documentation ¶ Index ¶ func ValueOf[T Constant[T]]() T type Channel func (c Channel) Default() Channel func (c Channel) MarshalJSON() ([]byte, error) type Constant type Video func (c Video) Default() Video func (c Video) MarshalJSON() ([]byte, error) 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 Channel ¶ type Channel string // Always "channel" func (Channel) Default ¶ func (c Channel) Default() Channel func (Channel) MarshalJSON ¶ func (c Channel) MarshalJSON() ([]byte, error) type Constant ¶ type Constant[T any] interface { Default() T } type Video ¶ type Video string // Always "video" func (Video) Default ¶ func (c Video) Default() Video func (Video) MarshalJSON ¶ func (c Video) MarshalJSON() ([]byte, error) Source Files ¶ View all Source files constants.go Click to show internal directories. Click to hide internal directories.