slicevalidation

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EQ

func EQ[T comparable, S ~[]T](s S, s2 S) (bool, []base.ErrorParam)

EQ checks a slice must equal to a slice

func ElemIn

func ElemIn[T comparable, S ~[]T](s S, values ...T) (bool, []base.ErrorParam)

ElemIn checks slice items must be in a list

func ElemNotIn

func ElemNotIn[T comparable, S ~[]T](s S, values ...T) (bool, []base.ErrorParam)

ElemNotIn checks slice items must be not in a list

func ElemRange

func ElemRange[T base.Number | base.String, S ~[]T](s S, min, max T) (bool, []base.ErrorParam)

ElemRange checks slice items must be in a range (applies to item type string or number only)

func HasElem added in v1.2.0

func HasElem[T comparable, S ~[]T](s S, values ...T) (bool, []base.ErrorParam)

HasElem checks slice must contain the specified values

func HasElemBy added in v1.2.0

func HasElemBy[T any, S ~[]T](s S, isExistFn func(T) bool) (bool, []base.ErrorParam)

HasElemBy checks slice must contain values using custom function

func Len

func Len[T any, S ~[]T](s S, min, max int) (bool, []base.ErrorParam)

Len checks slice length must be in a range

func NotHaveElem added in v1.2.0

func NotHaveElem[T comparable, S ~[]T](s S, values ...T) (bool, []base.ErrorParam)

NotHaveElem checks slice must not contain the specified values

func NotHaveElemBy added in v1.2.0

func NotHaveElemBy[T any, S ~[]T](s S, isExistFn func(T) bool) (bool, []base.ErrorParam)

NotHaveElemBy checks slice must not contain values using custom function

func Sorted

func Sorted[T base.Number | base.String, S ~[]T](s S) (bool, []base.ErrorParam)

Sorted checks slice items must be in ascending order

func SortedBy added in v1.1.0

func SortedBy[T any, U base.Number | base.String, S ~[]T](s S, keyFn func(T) U) (bool, []base.ErrorParam)

SortedBy checks slice items must be in ascending order defined by the function

func SortedDesc

func SortedDesc[T base.Number | base.String, S ~[]T](s S) (bool, []base.ErrorParam)

SortedDesc checks slice items must be in descending order

func SortedDescBy added in v1.1.0

func SortedDescBy[T any, U base.Number | base.String, S ~[]T](s S, keyFn func(T) U) (bool, []base.ErrorParam)

SortedDescBy checks slice items must be in descending order defined by the function

func Unique

func Unique[T comparable, S ~[]T](s S) (bool, []base.ErrorParam)

Unique checks slice items must be unique

func UniqueBy added in v1.1.0

func UniqueBy[T any, U comparable, S ~[]T](s S, keyFn func(T) U) (bool, []base.ErrorParam)

UniqueBy checks slice items must be unique

Types

This section is empty.

Jump to

Keyboard shortcuts

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