structs

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

original package located here https://github.com/mcuadros/go-lookup

Index

Constants

View Source
const (
	SplitToken     = "."
	IndexCloseChar = "]"
	IndexOpenChar  = "["
)

Variables

View Source
var (
	ErrMalformedIndex    = errors.New("malformed index key")
	ErrInvalidIndexUsage = errors.New("invalid index key usage")
	ErrKeyNotFound       = errors.New("unable to find the key")
	ErrIndexOutOfBounds  = errors.New("index out of bounds")
)

Functions

func Lookup

func Lookup(i any, path ...string) (reflect.Value, error)

Lookup performs a lookup into a value, using a path of keys. The key should match with a Field or a MapIndex. For slice you can use the syntax key[index] to access a specific index. If one key owns to a slice and an index is not specificied the rest of the path will be apllied to evaley value of the slice, and the value will be merged into a slice.

func LookupI

func LookupI(i any, path ...string) (reflect.Value, error)

LookupI is the same as Lookup, but the path keys are not case sensitive.

func LookupString

func LookupString(i any, path string) (reflect.Value, error)

but using a string with the keys separated by `.`.

func LookupStringI

func LookupStringI(i any, path string) (reflect.Value, error)

LookupStringI is the same as LookupString, but the path is not case sensitive.

Types

This section is empty.

Jump to

Keyboard shortcuts

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