validation

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAttributeFilterEmpty added in v0.5.6

func IsAttributeFilterEmpty(filter *base.AttributeFilter) bool

IsAttributeFilterEmpty checks if the provided AttributeFilter object is empty. An AttributeFilter is considered empty if none of its fields have been set.

func IsTupleFilterEmpty added in v0.5.6

func IsTupleFilterEmpty(filter *base.TupleFilter) bool

IsTupleFilterEmpty checks whether any of the fields in a TupleFilter are filled. It assumes that a filter is "empty" if all its fields are unset or have zero values.

func ValidateAttribute added in v0.5.0

func ValidateAttribute(definition *base.EntityDefinition, reqAttribute *base.Attribute) (err error)

ValidateAttribute checks whether a given attribute request (reqAttribute) aligns with the attribute definition in a given entity definition. It verifies if the attribute exists in the entity definition and if the attribute type matches the type specified in the request. If the attribute value is not of the expected type, an error is returned.

'definition' is the entity definition containing the definitions of valid attributes. 'reqAttribute' is the attribute that needs to be validated against the entity definition.

Returns nil if the attribute is valid, otherwise returns an error.

func ValidateBundleArguments added in v0.6.0

func ValidateBundleArguments(a []string, b map[string]string) error

ValidateBundleArguments checks if all strings in slice 'a' are keys in map 'b'.

func ValidateBundleOperation added in v0.6.0

func ValidateBundleOperation(op *base.Operation) error

ValidateBundleOperation checks for duplicate keys in various operations of a bundle.

func ValidateFilters added in v0.5.6

func ValidateFilters(tupleFilter *base.TupleFilter, attributeFilter *base.AttributeFilter) (err error)

ValidateFilters checks if both provided filters, tupleFilter and attributeFilter, are empty. It returns an error if both filters are empty, as at least one filter should contain criteria for the operation to be valid.

func ValidateTuple

func ValidateTuple(definition *base.EntityDefinition, tup *base.Tuple) (err error)

ValidateTuple checks if the provided tuple conforms to the entity definition and relation schema provided. It returns an error if the tuple is invalid.

func ValidateTupleFilter added in v0.5.0

func ValidateTupleFilter(tupleFilter *base.TupleFilter) (err error)

ValidateTupleFilter checks if the provided filter conforms to the entity definition

Types

This section is empty.

Jump to

Keyboard shortcuts

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