Skip to content

package stateref

import "github.com/cloudboss/unobin/pkg/stateref"

Functions

func AppendInstanceKey

func AppendInstanceKey(template string, key string) (string, error)

AppendInstanceKey returns template with key set on its final segment.

func Parent

func Parent(address string) (string, error)

Parent returns the slash parent of address, or empty for a root segment.

func Same

func Same(a, b EntryRef) bool

func SplitInstanceKey

func SplitInstanceKey(address string) (template string, key string, ok bool, err error)

SplitInstanceKey removes and returns the final segment's static key.

func Template

func Template(address string) (string, error)

Template removes static keys from every segment in address.

func ValidateAddress

func ValidateAddress(address string) error

Types

type Category

type Category string

type EntryRef

type EntryRef struct {
    Address string
}

func Parse

func Parse(s string) (EntryRef, error)

func (EntryRef) String

func (r EntryRef) String() string

type StateAddressSegment

type StateAddressSegment struct {
    Category Category
    Name     string
    Key      *StringKey
}

func (StateAddressSegment) String

func (s StateAddressSegment) String() string

type StateRef

type StateRef struct {
    Segments []StateAddressSegment
}

func ParseStateRef

func ParseStateRef(s string) (StateRef, error)

func (StateRef) String

func (s StateRef) String() string

type StringKey

type StringKey struct {
    Value string
}