va

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Code generated by genx:code DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractFloatScales

func ExtractFloatScales(v string) (w, p uint)

func ParseEnumValue

func ParseEnumValue[T Enum](data string) (T, error)

Types

type Enum

type Enum interface {
	Numeric | string
}

type EnumVa

type EnumVa[T comparable] struct {
	// contains filtered or unexported fields
}

func NewEnumVa

func NewEnumVa[T Enum](r rule.Rule) (*EnumVa[T], error)

func (*EnumVa[T]) BuiltTo

func (es *EnumVa[T]) BuiltTo(b rule.Builder)

func (*EnumVa[T]) Enums

func (es *EnumVa[T]) Enums() []any

func (*EnumVa[T]) Validate

func (es *EnumVa[T]) Validate(v T) error

type EnumValidation

type EnumValidation interface {
	Enums() []any
}

type Error

type Error int8

Error va error codes +genx:code

const (
	ERROR_UNDEFINED                 Error = iota
	ERROR__INVALID_LENGTH_RANGE           // invalid length range, expect 1 or 2 uint values
	ERROR__OUT_OF_LENGTH                  // input value out of length limitation
	ERROR__INVALID_VALUE_RANGE            // invalid range value
	ERROR__OUT_OF_VALUE_RANGE             // input value out of value range
	ERROR__INVALID_ENUM                   // invalid enumeration value
	ERROR__OUT_OF_ENUMERATED_VALUES       // input value out of enumerated values
	ERROR__INVALID_MULTIPLE               // invalid multiple
	ERROR__NOT_MATCH_MULTIPLE             // input value not match multiple
	ERROR__INVALID_FLOAT_SCALE            // invalid float scale, expect most 2 uint max 31
	ERROR__OUT_OF_FLOAT_SCALE             // input value out of float scale
	ERROR__INVALID_INT_BITS               // invalid int bits, expect most 1 uint max 64
	ERROR__OUT_OF_INT_BITS                // input value out of int bits
	ERROR__NOT_MATCH_REGEXP               // input value not match regexp
	ERROR__INVALID_INT_VALUE              // invalid input, expect int64/uint64
)

func (Error) Message

func (e Error) Message() string

type FloatScaleVa

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

func NewFloatScaleVa

func NewFloatScaleVa(r rule.Rule) (*FloatScaleVa, error)

func (*FloatScaleVa) BuildTo

func (fs *FloatScaleVa) BuildTo(b rule.Builder)

func (*FloatScaleVa) String

func (fs *FloatScaleVa) String() string

func (*FloatScaleVa) Validate

func (fs *FloatScaleVa) Validate(v string) error

type IntScaleVa

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

func NewIntScaleVa

func NewIntScaleVa(r rule.Rule) (*IntScaleVa, error)

func (*IntScaleVa) Bits

func (is *IntScaleVa) Bits() uint8

func (*IntScaleVa) BuiltTo

func (is *IntScaleVa) BuiltTo(b rule.Builder)

func (*IntScaleVa) String

func (is *IntScaleVa) String() string

func (*IntScaleVa) Unsigned

func (is *IntScaleVa) Unsigned() bool

func (*IntScaleVa) Validate

func (is *IntScaleVa) Validate(v any) error

type LengthVa

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

func NewLengthVa

func NewLengthVa(r rule.Rule) (*LengthVa, error)

func (*LengthVa) BuiltTo

func (lr *LengthVa) BuiltTo(b rule.Builder)

func (*LengthVa) LengthRange

func (lr *LengthVa) LengthRange() (*uint64, *uint64)

func (*LengthVa) String

func (lr *LengthVa) String() string

func (*LengthVa) Validate

func (lr *LengthVa) Validate(length uint) error

type LengthValidation

type LengthValidation interface {
	LengthRange() (*uint64, *uint64)
}

type MultipleVa

type MultipleVa[T Numeric] struct {
	// contains filtered or unexported fields
}

func NewMultipleVa

func NewMultipleVa[T Numeric](r rule.Rule) (*MultipleVa[T], error)

func (*MultipleVa[T]) BuiltTo

func (m *MultipleVa[T]) BuiltTo(b rule.Builder)

func (*MultipleVa[T]) MultipleOf

func (m *MultipleVa[T]) MultipleOf() T

func (*MultipleVa[T]) Validate

func (m *MultipleVa[T]) Validate(v T, precision uint) error

type Numeric

type Numeric interface {
	int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | float32 | float64
}

type NumericMultipleValidation

type NumericMultipleValidation[T Numeric] interface {
	MultipleOf() T
}

type NumericRangeValidation

type NumericRangeValidation[T Numeric] interface {
	Min() *T
	ExclusiveMin() bool
	Max() *T
	ExclusiveMax() bool
}

type RangeVa

type RangeVa[T Numeric] struct {
	// contains filtered or unexported fields
}

func NewRangeVa

func NewRangeVa[T Numeric](r rule.Rule) (*RangeVa[T], error)

func (*RangeVa[T]) BuiltTo

func (vr *RangeVa[T]) BuiltTo(b rule.Builder)

func (*RangeVa[T]) ExclusiveMax

func (vr *RangeVa[T]) ExclusiveMax() bool

func (*RangeVa[T]) ExclusiveMin

func (vr *RangeVa[T]) ExclusiveMin() bool

func (*RangeVa[T]) Max

func (vr *RangeVa[T]) Max() *T

func (*RangeVa[T]) Min

func (vr *RangeVa[T]) Min() *T

func (*RangeVa[T]) String

func (vr *RangeVa[T]) String() string

func (*RangeVa[T]) Validate

func (vr *RangeVa[T]) Validate(v T) error

type RegexpVa

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

func NewRegexpVa

func NewRegexpVa(r rule.Rule, hint string) *RegexpVa

func (*RegexpVa) BuiltTo

func (v *RegexpVa) BuiltTo(b rule.Builder)

func (*RegexpVa) Hint

func (v *RegexpVa) Hint() string

func (*RegexpVa) Pattern

func (v *RegexpVa) Pattern() string

func (*RegexpVa) Validate

func (v *RegexpVa) Validate(s string) error

Jump to

Keyboard shortcuts

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