attribute

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyBag emptyBag
View Source
var KindName = map[Kind]string{
	VALUE_TYPE_UNSPECIFIED: "VALUE_TYPE_UNSPECIFIED",
	STRING:                 "STRING",
	INT64:                  "INT64",
	DOUBLE:                 "DOUBLE",
	BOOL:                   "BOOL",
	TIMESTAMP:              "TIMESTAMP",
	IP_ADDRESS:             "IP_ADDRESS",
	EMAIL_ADDRESS:          "EMAIL_ADDRESS",
	URI:                    "URI",
	DNS_NAME:               "DNS_NAME",
	DURATION:               "DURATION",
	STRING_MAP:             "STRING_MAP",
	MOSN_CTX:               "MOSN_CTX",
}
View Source
var KindValue = map[string]Kind{}

Functions

This section is empty.

Types

type Bag

type Bag interface {
	// Get returns an attribute value.
	Get(name string) (value interface{}, found bool)
}

Bag is a generic mechanism to access a set of attributes.

type Expression

type Expression interface {
	// Evaluate evaluates this compiled expression against the attribute bag.
	Evaluate(bag Bag) (interface{}, error)
}

Expression represents a precompiled expression that can be immediately evaluated. It holds no cache and does not listen to any events. If the configuration changes, the CompiledExpression needs to be discarded and created again.

type Kind

type Kind uint8

cel type

const (
	// VALUE_TYPE_UNSPECIFIED ...
	// Invalid, default value.
	VALUE_TYPE_UNSPECIFIED Kind = iota
	// STRING ...
	// An undiscriminated variable-length string.
	STRING
	// INT64 ...
	// An undiscriminated 64-bit signed integer.
	INT64
	// DOUBLE ...
	// An undiscriminated 64-bit floating-point value.
	DOUBLE
	// BOOL ...
	// An undiscriminated boolean value.
	BOOL
	// TIMESTAMP ...
	// A point in time.
	TIMESTAMP
	// IP_ADDRESS ...
	// An IP address.
	IP_ADDRESS
	// EMAIL_ADDRESS ...
	// An email address.
	EMAIL_ADDRESS
	// URI ...
	// A URI.
	URI
	// DNS_NAME ...
	// A DNS name.
	DNS_NAME
	// DURATION ...
	// A span between two points in time.
	DURATION
	// STRING_MAP ...
	// A map string -> string, typically used by headers.
	STRING_MAP

	// A MOSN context, MOSN_CTX ...
	MOSN_CTX
)

func (Kind) String

func (k Kind) String() string

type MutableBag

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

MutableBag is a generic mechanism to read and write a set of attributes.

func NewMutableBag

func NewMutableBag(parent Bag) *MutableBag

NewMutableBag returns an initialized bag.

func NewMutableBagForMap

func NewMutableBagForMap(values map[string]interface{}) *MutableBag

NewMutableBagForMap returns a Mutable bag based on the specified map.

func (*MutableBag) Delete

func (mb *MutableBag) Delete(name string)

Delete removes a named item from the local state. The item may still be present higher in the hierarchy

func (*MutableBag) Get

func (mb *MutableBag) Get(name string) (interface{}, bool)

Get returns an attribute value.

func (*MutableBag) Reset

func (mb *MutableBag) Reset()

Reset removes all local state.

func (*MutableBag) Set

func (mb *MutableBag) Set(name string, value interface{})

Set creates an override for a named attribute.

Jump to

Keyboard shortcuts

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