models

package
v0.0.0-...-8af0a7f Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ColorValues = []Color{
	Red, Green, Blue, Other,
}

Functions

func GetValidateRequiredIfElement

func GetValidateRequiredIfElement(v *validator.Validate) validator.Func

func Register

func Register(v *validator.Validate)

func ValidateEnum

func ValidateEnum(fl validator.FieldLevel) bool

Types

type Color

type Color string
const (
	Red   Color = "red"
	Blue  Color = "blue"
	Green Color = "green"
	Other Color = "other"
)

func (Color) String

func (c Color) String() string

Stringer interface

func (Color) Valid

func (c Color) Valid() bool

type EnumValid

type EnumValid interface {
	Valid() bool
}

type MulPayload

type MulPayload struct {
	Colors []Color `json:"colors" validate:"dive,enum"`
	Other  string  `json:"other" validate:"required_if_element=Colors other"`
}

type Payload

type Payload struct {
	Color Color  `json:"color" validate:"enum"`
	Other string `json:"other" validate:"required_if=Color other"`
}

Jump to

Keyboard shortcuts

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