commonform

package
v0.0.0-...-6a757b2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 5 Imported by: 0

README

commonform 常用表单库

提供了常用的表单字段和表单操作

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MsgDuplicated = ui.NewMessage("herbgo.form", " {{label}} is duplicated.")

MsgDuplicated messages that shows field is duplicated.

View Source
var MsgIncorrect = ui.NewMessage("herbgo.form", "{{label}} is incorrect.")

MsgIncorrect messages that shows field is incorrect.

View Source
var MsgInvalide = ui.NewMessage("herbgo.form", "{{label}} is invalid.")

MsgInvalide messages that shows field is invalid.

View Source
var MsgNotMatch = ui.NewMessage("herbgo.form", "{{label}} is not match.")

MsgNotMatch messages that shows field is not match.

View Source
var MsgRequired = ui.NewMessage("herbgo.form", "{{label}} is required.")

MsgRequired message that shows field is required

Functions

func NewFormatWrongMsg

func NewFormatWrongMsg(format string) *ui.TemplateMessage

NewFormatWrongMsg create new message that shows field format wrong with given format.

func NewTooBigMsg

func NewTooBigMsg(max string) *ui.TemplateMessage

NewTooBigMsg create new message that shows field is too big with given max value.

func NewTooLongMsg

func NewTooLongMsg(max string) *ui.TemplateMessage

NewTooLongMsg create new message that shows field is too long with given max length.

func NewTooShortMsg

func NewTooShortMsg(min string) *ui.TemplateMessage

NewTooShortMsg create new message that shows field is too show with given min length.

func NewTooSmallMsg

func NewTooSmallMsg(min string) *ui.TemplateMessage

NewTooSmallMsg create new message that shows field is too small with given min value.

func NewWrongLengthMsg

func NewWrongLengthMsg(length string) *ui.TemplateMessage

NewWrongLengthMsg create new message that shows field length wrong with given length.

func SetTranslatedFieldLabels

func SetTranslatedFieldLabels(form validator.Fields, module string, labels map[string]string)

SetTranslatedFieldLabels set translated field labels to form.

func ValidateInt64InList

func ValidateInt64InList(form validator.Fields, value int64, field string, l *Int64List)

ValidateInt64InList validate required string field

func ValidateInt64Range

func ValidateInt64Range(form validator.Fields, value int64, field string, min int64, max int64)

ValidateInt64Range validate int value range

func ValidateIntInList

func ValidateIntInList(form validator.Fields, value int, field string, l *IntList)

ValidateIntInList validate required string field

func ValidateIntRange

func ValidateIntRange(form validator.Fields, value int, field string, min int, max int)

ValidateIntRange validate int value range

func ValidateListLength

func ValidateListLength(form validator.Fields, value interface{}, field string, min int, max int)

ValidateListLength validate list length

func ValidateRequiredFloat32

func ValidateRequiredFloat32(form validator.Fields, value float32, field string)

ValidateRequiredFloat32 validate required int field

func ValidateRequiredFloat64

func ValidateRequiredFloat64(form validator.Fields, value float64, field string)

ValidateRequiredFloat64 validate required int64 field

func ValidateRequiredInt

func ValidateRequiredInt(form validator.Fields, value int, field string)

ValidateRequiredInt validate required int field

func ValidateRequiredInt64

func ValidateRequiredInt64(form validator.Fields, value int64, field string)

ValidateRequiredInt64 validate required int64 field

func ValidateRequiredInterface

func ValidateRequiredInterface(form validator.Fields, value interface{}, field string)

ValidateRequiredInterface validate required interface field

func ValidateRequiredList

func ValidateRequiredList(form validator.Fields, value interface{}, field string)

ValidateRequiredList validate required list field

func ValidateRequiredPointer

func ValidateRequiredPointer(form validator.Fields, value interface{}, field string)

ValidateRequiredPointer validate required pointer field

func ValidateRequiredString

func ValidateRequiredString(form validator.Fields, value string, field string)

ValidateRequiredString validate required string field

func ValidateRequiredTime

func ValidateRequiredTime(form validator.Fields, value time.Time, field string)

ValidateRequiredTime validate required int64 field

func ValidateStringInList

func ValidateStringInList(form validator.Fields, value string, field string, l *StringList)

ValidateStringInList validate required string field

func ValidateStringLength

func ValidateStringLength(form validator.Fields, value string, field string, min int, max int)

ValidateStringLength validate string length

Types

type Int64List

type Int64List map[int64]bool

Int64List string list

func NewInt64List

func NewInt64List(values ...int64) *Int64List

NewInt64List create new string list

func (*Int64List) Has

func (l *Int64List) Has(value int64) bool

Has check if given value in list

type IntList

type IntList map[int]bool

IntList string list

func NewIntList

func NewIntList(values ...int) *IntList

NewIntList create new string list

func (*IntList) Has

func (l *IntList) Has(value int) bool

Has check if given value in list

type StringList

type StringList map[string]bool

StringList string list

func NewStringList

func NewStringList(values ...string) *StringList

NewStringList create new string list

func (*StringList) Has

func (l *StringList) Has(value string) bool

Has check if given value in list

Jump to

Keyboard shortcuts

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