attribute

package
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 5 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	Key   string
	Value Value
}

func Bool

func Bool(key string, v bool) Builder

Bool returns a Builder for a boolean.

func BoolSlice added in v0.44.0

func BoolSlice(key string, v []bool) Builder

BoolSlice returns a Builder for a bool slice.

func Float64

func Float64(key string, v float64) Builder

Float64 returns a Builder for a float64.

func Float64Slice added in v0.44.0

func Float64Slice(key string, v []float64) Builder

Float64Slice returns a Builder for a float64 slice.

func Int

func Int(key string, value int) Builder

Int returns a Builder for an int64.

func Int64

func Int64(key string, value int64) Builder

Int64 returns a Builder for an int64.

func Int64Slice added in v0.44.0

func Int64Slice(key string, v []int64) Builder

Int64Slice returns a Builder for an int64 slice.

func IntSlice added in v0.44.0

func IntSlice(key string, v []int) Builder

IntSlice returns a Builder for an int slice.

func String

func String(key, value string) Builder

String returns a Builder for a string value.

func StringSlice added in v0.44.0

func StringSlice(key string, v []string) Builder

StringSlice returns a Builder for a string slice.

func (*Builder) Valid

func (b *Builder) Valid() bool

Valid checks for valid key and type.

type Type

type Type int // redefines builtin Type.

Type describes the type of the data Value holds.

const (
	// INVALID is used for a Value with no value set.
	INVALID Type = iota
	// BOOL is a boolean Type Value.
	BOOL
	// INT64 is a 64-bit signed integral Type Value.
	INT64
	// FLOAT64 is a 64-bit floating point Type Value.
	FLOAT64
	// STRING is a string Type Value.
	STRING
	// BOOLSLICE is a slice of booleans Type Value.
	BOOLSLICE
	// INT64SLICE is a slice of 64-bit signed integral numbers Type Value.
	INT64SLICE
	// FLOAT64SLICE is a slice of 64-bit floating point numbers Type Value.
	FLOAT64SLICE
	// STRINGSLICE is a slice of strings Type Value.
	STRINGSLICE
	// UINT64 is a 64-bit unsigned integral Type Value.
	//
	// This type is intentionally not exposed through the Builder API.
	UINT64
)

func (Type) String

func (t Type) String() string

type Value

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

Value represents the value part in key-value pairs.

func BoolSliceValue added in v0.44.0

func BoolSliceValue(v []bool) Value

BoolSliceValue creates a BOOLSLICE Value.

func BoolValue

func BoolValue(v bool) Value

BoolValue creates a BOOL Value.

func Float64SliceValue added in v0.44.0

func Float64SliceValue(v []float64) Value

Float64SliceValue creates a FLOAT64SLICE Value.

func Float64Value

func Float64Value(v float64) Value

Float64Value creates a FLOAT64 Value.

func Int64SliceValue added in v0.44.0

func Int64SliceValue(v []int64) Value

Int64SliceValue creates an INT64SLICE Value.

func Int64Value

func Int64Value(v int64) Value

Int64Value creates an INT64 Value.

func IntSliceValue added in v0.44.0

func IntSliceValue(v []int) Value

IntSliceValue creates an INTSLICE Value.

func IntValue

func IntValue(v int) Value

IntValue creates an INT64 Value.

func StringSliceValue added in v0.44.0

func StringSliceValue(v []string) Value

StringSliceValue creates a STRINGSLICE Value.

func StringValue

func StringValue(v string) Value

StringValue creates a STRING Value.

func Uint64Value added in v0.43.0

func Uint64Value(v uint64) Value

Uint64Value creates a UINT64 Value.

This constructor is intentionally not exposed through the Builder API.

func (Value) AsBool

func (v Value) AsBool() bool

AsBool returns the bool value. Make sure that the Value's type is BOOL.

func (Value) AsBoolSlice added in v0.44.0

func (v Value) AsBoolSlice() []bool

AsBoolSlice returns the []bool value. Make sure that the Value's type is BOOLSLICE.

func (Value) AsFloat64

func (v Value) AsFloat64() float64

AsFloat64 returns the float64 value. Make sure that the Value's type is FLOAT64.

func (Value) AsFloat64Slice added in v0.44.0

func (v Value) AsFloat64Slice() []float64

AsFloat64Slice returns the []float64 value. Make sure that the Value's type is FLOAT64SLICE.

func (Value) AsInt64

func (v Value) AsInt64() int64

AsInt64 returns the int64 value. Make sure that the Value's type is INT64.

func (Value) AsInt64Slice added in v0.44.0

func (v Value) AsInt64Slice() []int64

AsInt64Slice returns the []int64 value. Make sure that the Value's type is INT64SLICE.

func (Value) AsInterface

func (v Value) AsInterface() interface{}

AsInterface returns Value's data as interface{}.

func (Value) AsString

func (v Value) AsString() string

AsString returns the string value. Make sure that the Value's type is STRING.

func (Value) AsStringSlice added in v0.44.0

func (v Value) AsStringSlice() []string

AsStringSlice returns the []string value. Make sure that the Value's type is STRINGSLICE.

func (Value) AsUint64 added in v0.43.0

func (v Value) AsUint64() uint64

AsUint64 returns the uint64 value. Make sure that the Value's type is UINT64.

func (Value) MarshalJSON

func (v Value) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of the Value.

func (Value) String

func (v Value) String() string

String returns a string representation of Value's data.

func (Value) Type

func (v Value) Type() Type

Type returns a type of the Value.

Jump to

Keyboard shortcuts

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