constraint

package
v0.4.2-rc3 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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Constraints

type Constraints uint32
const (
	// Attribute can't be left out (but can be null, empty, etc.)
	Required Constraints = (1 << iota)
	// Attribute can't be null
	NonNull
	// Attribute can't be an empty collections or an empty string
	NonEmpty
	// If an attribute is a string - preprocess it with strings.TrimSpace
	TrimSpace
	// Attribute must be a whole integer number
	Integer
)
const (
	// Attribute will be trimmed and later checked to be non-empty
	// If attribute is not a string - trim operation does nothing
	TrimmedNonEmpty Constraints = NonEmpty | TrimSpace

	// Attribute is not required, but (if specified) must be non-null, non-empty, strings are trimmed
	Meaningful Constraints = NonNull | TrimmedNonEmpty

	// Attribute is required, non-null, non-empty, strings are trimmed
	RequiredMeaningful Constraints = Required | Meaningful

	// Attribute is required and non-null
	RequiredNonNull Constraints = Required | NonNull
)

func (Constraints) Is

func (c Constraints) Is(test Constraints) bool

type OneOf

type OneOf []cty.Value

func (OneOf) IsEmpty

func (o OneOf) IsEmpty() bool

func (OneOf) String

func (o OneOf) String() string

func (OneOf) Validate

func (o OneOf) Validate(val cty.Value) (valid bool)

Jump to

Keyboard shortcuts

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