Help us shape the future of Go! Take the 2026 Go Developer Survey

extensions

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ErrNotFound = errors.Error("not found")
)

Variables

This section is empty.

Functions

func GetExtensionValue added in v0.1.0

func GetExtensionValue[T any](e *Extensions, ext string) (*T, error)

GetExtensionValue will return the value of the extension. Useful for scalar values or where a model without a core is required.

func UnmarshalExtensionModel added in v0.1.0

func UnmarshalExtensionModel[H any, L any](ctx context.Context, e *Extensions, ext string, m *H) ([]error, error)

UnmarshalExtensionModel will unmarshal the extension into a model and its associated core model.

Types

type Element

type Element struct {
	*sequencedmap.Element[string, Extension]
}

Element represents a key/value pair of a set of extensions.

func NewElem

func NewElem(key string, value *yaml.Node) *Element

NewElem will create a new element for the extensions set.

type Extension

type Extension = *yaml.Node

Extension represents a single extension to an object, in its raw form.

type Extensions

type Extensions struct {
	*sequencedmap.Map[string, Extension]
	// contains filtered or unexported fields
}

Extensions represents a set of extensions to an object.

func New

func New(elements ...*Element) *Extensions

New will create a new extensions set.

func (*Extensions) GetCore added in v0.1.2

func (*Extensions) Init

func (e *Extensions) Init()

Init will initialize the extensions set.

func (*Extensions) IsEqual added in v1.0.0

func (e *Extensions) IsEqual(other *Extensions) bool

IsEqual compares two Extensions instances for equality. Treats both empty and nil extensions as equal.

func (*Extensions) Len added in v1.7.6

func (e *Extensions) Len() int

Len returns the number of elements in the extensions map. nil safe.

func (*Extensions) Populate added in v0.2.1

func (e *Extensions) Populate(source any) error

func (*Extensions) SetCore added in v0.1.0

func (e *Extensions) SetCore(core any)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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