safe

package
v0.0.0-...-7e7e286 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MetadataMapstructureHook

func MetadataMapstructureHook() mapstructure.DecodeHookFuncType

Types

type Map

type Map[T any] struct {
	// contains filtered or unexported fields
}

func (*Map[T]) Count

func (sm *Map[T]) Count() int

func (*Map[T]) Data

func (sm *Map[T]) Data() map[string]T

func (*Map[T]) Get

func (sm *Map[T]) Get(key string) (T, bool)

func (*Map[T]) Keys

func (sm *Map[T]) Keys() []string

func (*Map[T]) Merge

func (sm *Map[T]) Merge(values map[string]T)

func (*Map[T]) Sample

func (sm *Map[T]) Sample() T

func (*Map[T]) Set

func (sm *Map[T]) Set(key string, value T)

type Metadata

type Metadata struct {
	// contains filtered or unexported fields
}

Metadata is a thread-safe key-value store. There are some gotchas when using this struct: json marshalling is supported but all number will be parsed as float64. yaml marshalling is supported but all number will be parsed as int.

func (*Metadata) FromHttpHeader

func (meta *Metadata) FromHttpHeader(headers http.Header)

func (*Metadata) Get

func (meta *Metadata) Get(k string) (any, bool)

func (*Metadata) MarshalJSON

func (meta *Metadata) MarshalJSON() ([]byte, error)

func (*Metadata) MarshalYAML

func (meta *Metadata) MarshalYAML() (interface{}, error)

func (*Metadata) Merge

func (meta *Metadata) Merge(src *Metadata)

func (*Metadata) Scan

func (meta *Metadata) Scan(value any) error

Scan implements the Scanner interface.

func (*Metadata) Set

func (meta *Metadata) Set(k string, v any)

func (*Metadata) String

func (meta *Metadata) String() string

func (*Metadata) ToHttpHeader

func (meta *Metadata) ToHttpHeader() http.Header

func (*Metadata) UnmarshalJSON

func (meta *Metadata) UnmarshalJSON(data []byte) error

func (*Metadata) UnmarshalYAML

func (meta *Metadata) UnmarshalYAML(value *yaml.Node) error

func (*Metadata) Value

func (meta *Metadata) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Slice

type Slice[T any] struct {
	// contains filtered or unexported fields
}

func (*Slice[T]) Append

func (sm *Slice[T]) Append(values ...T)

func (*Slice[T]) Count

func (sm *Slice[T]) Count() int

func (*Slice[T]) Data

func (sm *Slice[T]) Data() []T

Jump to

Keyboard shortcuts

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