keyop

package
v3.0.0-rc67 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ops

func Ops() []string

Types

type L

type L []T

L is a list of T

func ParseList

func ParseList(exprs ...string) L

func ParseOps

func ParseOps(kws []string) L

ParseOps function processes a list of strings, parses them into operations, filters out any invalid operations (based on the IsZero check), and returns a list of valid operations.

func (L) Drop

func (t L) Drop(k key.T) (l L)

type Op

type Op int

Op is an integer representing an operation on a configuration key value

const (
	// Invalid is for invalid operator
	Invalid Op = iota
	// Set overwrites the value
	Set
	// Append appends an element, even if already present
	Append
	// Remove removes an element if present, do nothing if not present
	Remove
	// Merge adds an element if not present, do nothing if present
	Merge
	// Toggle adds an element if not present, removes it if present
	Toggle
	// Insert adds an element at the position specified by Index
	Insert
	// Exist tests the existence of a key
	Exist
	// Equal tests if the current value of the key is equal to the keyop.T value
	Equal
	// NotEqual tests if the current value of the key is not equal to the keyop.T value
	NotEqual
	// GreaterOrEqual tests if the current value of the key is greater or equal to the keyop.T value
	GreaterOrEqual
	// LesserOrEqual tests if the current value of the key is lesser or equal to the keyop.T value
	LesserOrEqual
	// Greater tests if the current value of the key is greater to the keyop.T value
	Greater
	// Lesser tests if the current value of the key is lesser to the keyop.T value
	Lesser
)

func ParseOp

func ParseOp(s string) Op

ParseOp returns an operator from its string representation.

func (Op) Is

func (t Op) Is(op Op) bool

func (Op) MarshalJSON

func (t Op) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string

func (Op) String

func (t Op) String() string

func (*Op) UnmarshalJSON

func (t *Op) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals a quoted json string to the enum value

type T

type T struct {
	Key   key.T
	Op    Op
	Value string
	Index int
}

T defines a parsed key operation

func New

func New(key key.T, op Op, value string, idx int) *T

func Parse

func Parse(s string) *T

func (T) IsZero

func (t T) IsZero() bool

func (T) String

func (t T) String() string

Jump to

Keyboard shortcuts

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