sdcheck

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package sdcheck 检测条件是否满足,用于参数验证等

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker interface {
	Check() error
}

type Func

type Func func() error

func All

func All(checkers ...Checker) Func

func And

func And(checkers []Checker, message any) Func

func False

func False(b bool, message any) Func

func For

func For[T any](f FuncFor[T], ptr *T) Func

func HasKey

func HasKey[K comparable, V any, M ~map[K]V](k K, m M, message any) Func

func HasPrefix

func HasPrefix(s string, prefix string, message any) Func

func HasSub

func HasSub(s string, substr string, message any) Func

func HasSuffix

func HasSuffix(s string, suffix string, message any) Func

func If

func If(enabled bool, checker Checker) Func

func In

func In[T comparable, C ~[]T](v T, available C, message any) Func

func Len

func Len(v any, minLen, maxLen int, message any) Func

func MatchRegexp

func MatchRegexp(s, pattern string, message any) Func

func MatchRegexpPattern

func MatchRegexpPattern(s string, pattern *regexp.Regexp, message any) Func

func Not

func Not(c Checker, message any) Func

func NotHasKey

func NotHasKey[K comparable, V any, M ~map[K]V](k K, m M, message any) Func

func NotIn

func NotIn[T comparable, C ~[]T](v T, available C, message any) Func

func Or

func Or(checkers []Checker, message any) Func

func Required

func Required(v any, message any) Func

func True

func True(b bool, message any) Func

func (Func) Check

func (f Func) Check() error

type FuncFor

type FuncFor[T any] func() (T, error)

type Lazy

type Lazy func() Checker

func (Lazy) Check

func (l Lazy) Check() error

Jump to

Keyboard shortcuts

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