attribute

package
v0.35.3 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 4 Imported by: 5

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 Float64

func Float64(key string, v float64) Builder

Float64 returns a Builder for a float64.

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 String

func String(key, value string) Builder

String returns a Builder for a string value.

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
)

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 BoolValue

func BoolValue(v bool) Value

BoolValue creates a BOOL Value.

func Float64Value

func Float64Value(v float64) Value

Float64Value creates a FLOAT64 Value.

func Int64Value

func Int64Value(v int64) Value

Int64Value creates an INT64 Value.

func IntValue

func IntValue(v int) Value

IntValue creates an INT64 Value.

func StringValue

func StringValue(v string) Value

StringValue creates a STRING Value.

func (Value) AsBool

func (v Value) AsBool() bool

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

func (Value) AsFloat64

func (v Value) AsFloat64() float64

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

func (Value) AsInt64

func (v Value) AsInt64() int64

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

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) 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