vdg

package module
v0.0.0-...-617f752 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Slice

func Slice[T comparable](r *vd.Rule, slice []T, spec SliceSpec, elementCheck ...func(v T, index int) (err error))

Types

type SliceSpec

type SliceSpec struct {
	Name          string
	Path          string
	MinLen        vd.OptionInt
	MinLenMessage string
	MaxLen        vd.OptionInt
	MaxLenMessage string
	Unique        bool
}

SliceSpec 不实现 AllowEmpty 因为与 MinLen 实现重复。会增加使用者学习成本

func (SliceSpec) CheckMaxLen

func (spec SliceSpec) CheckMaxLen(v int, r *vd.Rule) (fail bool)

func (SliceSpec) CheckMinLen

func (spec SliceSpec) CheckMinLen(v int, r *vd.Rule) (fail bool)

Jump to

Keyboard shortcuts

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