constant

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 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 Error

type Error string // Always "error"

func (Error) Default

func (c Error) Default() Error

func (Error) MarshalJSON

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

type JsonObject

type JsonObject string // Always "json_object"

func (JsonObject) Default

func (c JsonObject) Default() JsonObject

func (JsonObject) MarshalJSON

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

type JsonSchema

type JsonSchema string // Always "json_schema"

func (JsonSchema) Default

func (c JsonSchema) Default() JsonSchema

func (JsonSchema) MarshalJSON

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

type Text

type Text string // Always "text"

func (Text) Default

func (c Text) Default() Text

func (Text) MarshalJSON

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

Jump to

Keyboard shortcuts

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