attribute

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ENTITY    = "%s:%s"
	ATTRIBUTE = "$%s"
	VALUE     = "%s:%s"
)

Variables

View Source
var (
	ErrInvalidEntity    = errors.New("invalid entity")
	ErrInvalidAttribute = errors.New("invalid attribute")
	ErrInvalidValue     = errors.New("invalid value")
)

Functions

func AnyToString

func AnyToString(any *anypb.Any) string

AnyToString function takes an Any proto message and converts it into a string.

func Attribute

func Attribute(attribute string) (*base.Attribute, error)

Attribute function takes a string representation of an attribute and converts it back into the Attribute object.

func CallOrAttributeToString added in v0.5.1

func CallOrAttributeToString(attributeOrCall string, arguments ...*base.Argument) string

CallOrAttributeToString -

func EntityAndAttributeToString added in v0.7.6

func EntityAndAttributeToString(entity *base.Entity, attr string) string

EntityAndAttributeToString converts an entity and attribute to a single string.

func EntityAndCallOrAttributeToString added in v0.5.1

func EntityAndCallOrAttributeToString(entity *base.Entity, attributeOrCall string, arguments ...*base.Argument) string

EntityAndCallOrAttributeToString -

func EntityToString

func EntityToString(entity *base.Entity) string

EntityToString function takes an Entity object and converts it into a string.

func ToString

func ToString(attribute *base.Attribute) string

ToString function takes an Attribute object and converts it into a string.

func TypeToString

func TypeToString(attributeType base.AttributeType) string

TypeToString function takes an AttributeType enum and converts it into a string.

func TypeUrlToString

func TypeUrlToString(url string) string

func ValidateValue

func ValidateValue(any *anypb.Any, attributeType base.AttributeType) error

ValidateValue checks the validity of the 'any' parameter which is a protobuf 'Any' type, based on the attribute type provided.

'any' is a protobuf 'Any' type which should contain a value of a specific type. 'attributeType' is an enum indicating the expected type of the value within 'any'. The function returns an error if the value within 'any' is not of the expected type, or if unmarshalling fails.

The function returns nil if the value is valid (i.e., it is of the expected type and can be successfully unmarshalled).

Types

This section is empty.

Jump to

Keyboard shortcuts

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