utils

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Param

type Param struct {
	Key   string
	Value string
}

type State

type State []Param

State represents a collection of parameters.

func DecodeState

func DecodeState(s string) State

DecodeState deserializes a base64-encoded BSON string back into a State.

func NewState

func NewState(params ...Param) State

NewState creates a new State from the given parameters.

func (State) Encode

func (s State) Encode() string

Encode serializes the State to a base64-encoded BSON string.

func (State) Extend

func (s State) Extend(key, value string) State

Extend adds or updates a parameter in the State.

func (State) Get

func (s State) Get(key string) string

Get retrieves the value for a given key, returning an empty string if not found.

func (State) Has

func (s State) Has(key string) bool

Has checks if a parameter with the given key exists in the State.

func (State) Len

func (s State) Len() int

Len returns the length of the State (implements sort.Interface).

func (State) Less

func (s State) Less(i, j int) bool

Less compares two elements for sorting (implements sort.Interface). Sorts by Key first, then by Value if Keys are equal.

func (State) Swap

func (s State) Swap(i, j int)

Swap swaps two elements in the State (implements sort.Interface).

Jump to

Keyboard shortcuts

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