dict

package
v0.0.0-...-3839eb7 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StringType uint8 = iota
	Int64Type
	Float64Type
	BoolType
)

Variables

View Source
var (
	ErrDictNotFound        = errs.NewI18nError("dict.notfound").FallBack("dict not found")
	ErrDictCodeConflict    = errs.NewI18nError("dict.codeConflict").FallBack("dict code conflict")
	ErrDictDataNotFound    = errs.NewI18nError("dict.data.notfound").FallBack("dict data not found")
	ErrDictDataKeyConflict = errs.NewI18nError("dict.data.keyConflict").FallBack("dict data key conflict")

	ErrInvalidDictDatType = errs.NewI18nError("dict.data.invalidType").FallBack("invalid dict data type")
)
View Source
var (
	RuleDictName  = helper.Rules(vax.RangeLenRune(1, 30))
	RuleDictCode  = helper.Rules(vax.RangeLenRune(1, 30))
	RuleDictKey   = helper.Rules(vax.RangeLenRune(1, 30))
	RuleDictValue = helper.Rules(vax.RangeLenRune(1, 200))

	RuleDictDataType = helper.Rules(vax.In(StringType, Int64Type, Float64Type, BoolType))
)
View Source
var (
	ErrInvalidDicType = errors.New("invalid dict data type")
)

Functions

This section is empty.

Types

type CodeKeyOption

type CodeKeyOption struct {
	CodeOption
	Key string `json:"key" uri:"key" form:"key" label:"dict.key"`
}

func (CodeKeyOption) Validate

func (d CodeKeyOption) Validate(lang string) error

type CodeOption

type CodeOption struct {
	Code string `json:"code" uri:"code" form:"code" label:"dict.code"`
}

func (CodeOption) Validate

func (d CodeOption) Validate(lang string) error

type DictDataDetail

type DictDataDetail struct {
	Id     uint   `json:"id"`
	Label  string `json:"label"`
	Key    string `json:"key"`
	Value  any    `json:"value"`
	Type   uint8  `json:"type"`
	Order  int    `json:"order"`
	Enable bool   `json:"enable"`

	CreatedAt uint64 `json:"createdAt"`
	UpdatedAt uint64 `json:"updatedAt"`
}

type DictDataInfo

type DictDataInfo struct {
	Label string `json:"label"`
	Key   string `json:"key"`
	Value any    `json:"value"`
	Type  uint8  `json:"type"`
}

type DictDataPageOption

type DictDataPageOption struct {
	helper.PageOption
	Code   string `json:"code" uri:"code" form:"code" label:"dict.code"`
	Search string `json:"search" uri:"search" form:"search"`
}

func (DictDataPageOption) Validate

func (d DictDataPageOption) Validate(lang string) error

type DictDataSaveOption

type DictDataSaveOption struct {
	DictId uint   `json:"dictId"`
	Name   string `json:"name" label:"dict.name"`
	Key    string `json:"key" label:"dict.key"`
	Value  string `json:"value" label:"dict.value"`
	Type   uint8  `json:"type" label:"dict.type"`
	Order  int    `json:"order" label:"dict.order"`
}

func (DictDataSaveOption) Validate

func (d DictDataSaveOption) Validate(lang string) error

type DictDataUpdateOption

type DictDataUpdateOption struct {
	Id     uint   `json:"id"`
	Name   string `json:"name"`
	Key    string `json:"key"`
	Value  string `json:"value"`
	Type   uint8  `json:"type"`
	Order  int    `json:"order"`
	Enable bool
}

func (DictDataUpdateOption) Validate

func (d DictDataUpdateOption) Validate(lang string) error

type DictDetail

type DictDetail struct {
	Id        uint   `json:"id"`
	Name      string `json:"name"`
	Code      string `json:"code"`
	CreatedAt uint64 `json:"createdAt"`
	UpdatedAt uint64 `json:"updatedAt"`
}

type DictPageOption

type DictPageOption struct {
	helper.PageOption
	Search string `json:"search" uri:"search" form:"search"`
}

func (DictPageOption) Validate

func (p DictPageOption) Validate(lang string) error

type DictSaveOption

type DictSaveOption struct {
	Name string `json:"name" label:"dict.name"`
	Code string `json:"code" label:"dict.code"`
}

func (DictSaveOption) Validate

func (d DictSaveOption) Validate(lang string) error

type DictUpdateOption

type DictUpdateOption struct {
	Id uint `json:"id"`
	DictSaveOption
}

func (DictUpdateOption) Validate

func (d DictUpdateOption) Validate(lang string) error

Jump to

Keyboard shortcuts

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