ordered

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RewrapValue

func RewrapValue(v interface{}) interface{}

RewrapValue recursively converts map[string]interface{} values to *Map, restoring Each()/LiquidMethodMissing() after JSON round-trip through the plugin serialization boundary.

func UnmarshalJSONValue

func UnmarshalJSONValue(data []byte) (interface{}, error)

UnmarshalJSONValue parses a top-level JSON value, using *Map for objects. For arrays and scalars, returns the standard Go types.

Types

type KVPair

type KVPair struct {
	Key   string
	Value interface{}
}

type Map

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

func New

func New() *Map

func (*Map) Delete

func (m *Map) Delete(key string)

func (*Map) Each

func (m *Map) Each(fn func(interface{}))

Each yields [key, value] pairs in insertion order. Implements the iteration interface expected by liquidgo's SliceCollection.

func (*Map) Entries

func (m *Map) Entries() []KVPair

func (*Map) First

func (m *Map) First() interface{}

First returns the first [key, value] pair (accessed as .first in Liquid).

func (*Map) Get

func (m *Map) Get(key string) interface{}

func (*Map) GetValue

func (m *Map) GetValue(key string) (interface{}, bool)

func (*Map) Has

func (m *Map) Has(key string) bool

func (*Map) Keys

func (m *Map) Keys() []string

func (*Map) Len

func (m *Map) Len() int

func (*Map) LiquidMethodMissing

func (m *Map) LiquidMethodMissing(key string) interface{}

LiquidMethodMissing enables property access from Liquid templates. {{ site.data.team.alice }} calls LiquidMethodMissing("alice").

func (*Map) MarshalJSON

func (m *Map) MarshalJSON() ([]byte, error)

func (*Map) Set

func (m *Map) Set(key string, value interface{})

func (*Map) Size

func (m *Map) Size() int

Size returns the number of entries (accessed as .size in Liquid).

func (*Map) ToGoMap

func (m *Map) ToGoMap() map[string]interface{}

ToGoMap converts to a standard map[string]interface{}, losing key order. Nested *Map values are recursively converted.

func (*Map) UnmarshalJSON

func (m *Map) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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