key

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeySeparator    = "/"
	PrefixSeparator = "$"
)

Variables

View Source
var (
	ErrNotEnoughParts   = errors.New("ErrNotEnoughParts")
	ErrInvalidKeyFormat = errors.New("ErrInvalidKeyFormat")
)

Functions

func Namespace

func Namespace() string

Namespace returns the current global fxapp namespace.

func NamespaceKeyPrefix

func NamespaceKeyPrefix() string

func SetNamespace

func SetNamespace(ns string)

SetNamespace sets the global fxapp namespace.

Types

type Key

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

A Key is a structured abstraction of a Couchbase nosql identifier.

func MustSucceed

func MustSucceed(key Key, err error) Key

MustSucceed is a handy wrapper for panicking when creating a new Key. Example: MustSucceed(NewKeyFromString("xyz")).

func NewKey

func NewKey(value string) Key

NewKey constructs a new keys from the given fully qualified string. It will panic if the string isn't valid. Use NewKeyFromString if you don't want to panic.

func NewKeyFromBytesUnchecked

func NewKeyFromBytesUnchecked(value []byte) Key

NewKeyFromBytesUnchecked creates a new keys from the given byte array without validation of any kind.

func NewKeyFromParts

func NewKeyFromParts(parts ...string) (key Key, err error)

NewKeyFromParts creates a new keys within the current core.Namespace.

func NewKeyFromString

func NewKeyFromString(value string) (key Key, err error)

NewKeyFromString creates a new keys within the current core.Namespace from a string representation, validating each part.

func NewKeyFromStringUnchecked

func NewKeyFromStringUnchecked(value string) Key

NewKeyFromStringUnchecked creates a new keys from the given byte array without validation of any kind.

func NewKeys

func NewKeys(values ...string) []Key

func (*Key) Base

func (k *Key) Base() string

Base returns the final KeySeparator-separated element of the keys.

func (*Key) Bytes

func (k *Key) Bytes() []byte

func (*Key) Clear

func (k *Key) Clear()

Clear any value in this keys.

func (*Key) HasValue

func (k *Key) HasValue() bool

func (*Key) IsEmpty

func (k *Key) IsEmpty() bool

func (*Key) IsEqual

func (k *Key) IsEqual(s string) bool

func (*Key) Parts

func (k *Key) Parts() []string

Parts returns a slice of the component parts of the keys.

func (*Key) Prefix

func (k *Key) Prefix() string

func (*Key) Prefixes

func (k *Key) Prefixes() []string

Prefixes returns a slice of PrefixSeparator-separated elements of the Base.

func (*Key) String

func (k *Key) String() string

Jump to

Keyboard shortcuts

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