field

package
v0.0.0-...-07389d8 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Null   = Kind(gjson.Null)
	False  = Kind(gjson.False)
	Number = Kind(gjson.Number)
	String = Kind(gjson.String)
	True   = Kind(gjson.True)
	JSON   = Kind(gjson.JSON)
)

Variables

View Source
var ZeroField = Field{/* contains filtered or unexported fields */}
View Source
var ZeroValue = Value{/* contains filtered or unexported fields */}

Functions

This section is empty.

Types

type Field

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

func Make

func Make(name, data string) Field

func (Field) Name

func (f Field) Name() string

func (Field) Value

func (f Field) Value() Value

func (Field) Weight

func (f Field) Weight() int

type Kind

type Kind byte

type List

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

List of fields, ordered by Name.

func MakeList

func MakeList(fields []Field) List

MakeList returns a field list from an array of fields.

func (List) Get

func (fields List) Get(name string) Field

Get a field from the list. Or returns ZeroField if not found.

func (List) Len

func (fields List) Len() int

Len return the number of fields in list.

func (List) Scan

func (fields List) Scan(iter func(field Field) bool)

Scan each field in list

func (List) Set

func (fields List) Set(field Field) List

Set a field in the list. If the input field value is zero `f.Value().IsZero()` then the field is deleted or removed from the list since lists cannot have Zero values. Returns a newly allocated list the updated field. The original (receiver) list is not modified.

func (List) String

func (fields List) String() string

func (List) Weight

func (fields List) Weight() int

Weight is the number of bytes of the list.

type Value

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

func ValueOf

func ValueOf(data string) Value

func (Value) Data

func (v Value) Data() string

func (Value) Equals

func (v Value) Equals(b Value) bool

func (Value) IsZero

func (v Value) IsZero() bool

func (Value) JSON

func (v Value) JSON() string

func (Value) Kind

func (v Value) Kind() Kind

func (Value) Less

func (v Value) Less(b Value) bool

Less return true if a value is less than another value.

Null < False < Number < String < True < JSON

Pulled from github.com/tidwall/gjson

func (Value) LessCase

func (v Value) LessCase(b Value, caseSensitive bool) bool

Less return true if a value is less than another value. The caseSensitive parameter is used when the value are Strings. The order when comparing two different kinds is:

Null < False < Number < String < True < JSON

Pulled from github.com/tidwall/gjson

func (Value) Num

func (v Value) Num() float64

Jump to

Keyboard shortcuts

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