validator

package
v0.11.6 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsChinese

func ContainsChinese(s string) bool

ContainsChinese checks if a string contains any Chinese characters.

func EmptyToDefault

func EmptyToDefault(str string, defaultStr string) string

EmptyToDefault returns defaultStr if str is empty; otherwise, returns str.

func HasEmpty

func HasEmpty(elems []interface{}) (bool, int)

HasEmpty checks if any element in the slice is empty.

func IsAllEmpty

func IsAllEmpty(elems []interface{}) bool

IsAllEmpty checks if all elements in the slice are empty.

func IsEmptyValue

func IsEmptyValue(v reflect.Value) bool

isEmptyValue checks if a reflect.Value is empty.

func IsUndefined

func IsUndefined(str string) bool

IsUndefined checks if a string is "undefined" (case insensitive).

func NotEmpty

func NotEmpty() string

NotEmpty returns the rule string for non-empty validation.

func RegisterRule

func RegisterRule(key string, rule Rules) error

RegisterRule registers a custom validation rule.

func Verify

func Verify(st interface{}, roleMap Rules) error

Verify validates the struct fields based on the provided rules.

Types

type Rules

type Rules map[string][]string

Jump to

Keyboard shortcuts

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