...

Package validate

import "gitlab.hexacode.org/go-libs/microservice/validate"
Overview
Index

Overview ▾

type Options

type Options struct {
    Name        string     `json:"name,omitempty"`
    Label       string     `json:"label,omitempty"`
    Placeholder string     `json:"placeholder,omitempty"`
    Type        string     `json:"type,omitempty"`
    Required    bool       `json:"required,omitempty"`
    Regex       string     `json:"regex,omitempty"`
    Min         int        `json:"min,omitempty"`
    Max         int        `json:"max,omitempty"`
    MinFloat    float32    `json:"min_float,omitempty"`
    MaxFloat    float32    `json:"max_float,omitempty"`
    Children    []*Options `json:"children,omitempty"`
    ValueText   string     `json:"value_text,omitempty"`
    ValueNumber int64      `json:"value_number,omitempty"`
    ValueFloat  float32    `json:"value_float,omitempty"`
    ValueDouble float64    `json:"value_double,omitempty"`
}

func (*Options) ValidDouble

func (options *Options) ValidDouble() error

func (*Options) ValidEmail

func (options *Options) ValidEmail() error

func (*Options) ValidFload

func (options *Options) ValidFload() error

func (*Options) ValidName

func (options *Options) ValidName() error

func (*Options) ValidNumber

func (options *Options) ValidNumber() error

func (*Options) ValidPassword

func (options *Options) ValidPassword() error

func (*Options) ValidPhone

func (options *Options) ValidPhone() error

func (*Options) ValidText

func (options *Options) ValidText() error

func (*Options) ValidTextNumber

func (options *Options) ValidTextNumber() error

func (*Options) ValidUsername

func (options *Options) ValidUsername() error

func (*Options) Validate

func (options *Options) Validate(value interface{}) *ValidateError

type ValidateError

type ValidateError struct {
    Name     string           `json:"name,omitempty"`
    Message  string           `json:"message,omitempty"`
    Value    interface{}      `json:"value,omitempty"`
    Children []*ValidateError `json:"children,omitempty"`
}

func Validate

func Validate(optionses []*Options, values hctypes.Dict) []*ValidateError