check

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEmpty

func IsEmpty(hint ...string) interface{}

Types

type Check

type Check[T any] interface {
	Check(T) CheckOutput
}

func And

func And[T any](checks ...Check[T]) Check[T]

func Contains

func Contains(value string, rest ...any) Check[string]

func Has

func Has(values ...string) Check[[]string]

func IsEqualBytes

func IsEqualBytes(value []byte) Check[[]byte]

golang doesn't support method overloading / generic specialization

func IsJSONEqual

func IsJSONEqual(value []byte) Check[[]byte]

func IsUniqAnd

func IsUniqAnd(check Check[string]) Check[[]string]

func Matches

func Matches(value string, rest ...any) Check[string]

func Not

func Not[T any](check Check[T]) Check[T]

type CheckAnd

type CheckAnd[T any] struct {
	Checks []Check[T]
}

func (*CheckAnd[T]) Check

func (c *CheckAnd[T]) Check(v T) CheckOutput

type CheckContains

type CheckContains struct {
	Value string
}

func (*CheckContains) Check

func (c *CheckContains) Check(v string) CheckOutput

type CheckFunc

type CheckFunc[T any] struct {
	Fn func(T) bool
}

func (CheckFunc[T]) Check

func (c CheckFunc[T]) Check(v T) CheckOutput

type CheckHas

type CheckHas struct {
	// contains filtered or unexported fields
}

func (*CheckHas) Check

func (c *CheckHas) Check(v []string) CheckOutput

type CheckIsCarFile

type CheckIsCarFile struct {
	// contains filtered or unexported fields
}

func IsCar

func IsCar() *CheckIsCarFile

func (*CheckIsCarFile) Check

func (c *CheckIsCarFile) Check(carContent []byte) CheckOutput

func (CheckIsCarFile) Exactly

func (c CheckIsCarFile) Exactly() *CheckIsCarFile

func (CheckIsCarFile) HasBlock

func (c CheckIsCarFile) HasBlock(cidStr string) *CheckIsCarFile

func (CheckIsCarFile) HasBlocks

func (c CheckIsCarFile) HasBlocks(cidStrs ...string) *CheckIsCarFile

func (CheckIsCarFile) HasRoot

func (c CheckIsCarFile) HasRoot(cidStr string) *CheckIsCarFile

func (CheckIsCarFile) HasRoots

func (c CheckIsCarFile) HasRoots(cidStrs ...string) *CheckIsCarFile

func (CheckIsCarFile) IgnoreRoots

func (c CheckIsCarFile) IgnoreRoots() *CheckIsCarFile

func (CheckIsCarFile) InThatOrder

func (c CheckIsCarFile) InThatOrder() *CheckIsCarFile

func (CheckIsCarFile) MightHaveNoRoots

func (c CheckIsCarFile) MightHaveNoRoots() *CheckIsCarFile

type CheckIsEmpty

type CheckIsEmpty struct {
}

func (CheckIsEmpty) Check

func (c CheckIsEmpty) Check(v []string) CheckOutput

type CheckIsEqual

type CheckIsEqual[T comparable] struct {
	Value T
}

func IsEqual

func IsEqual(value string, rest ...any) CheckIsEqual[string]

func IsEqualT

func IsEqualT[T comparable](value T) *CheckIsEqual[T]

func (CheckIsEqual[T]) Check

func (c CheckIsEqual[T]) Check(v T) CheckOutput

type CheckIsEqualBytes

type CheckIsEqualBytes struct {
	Value []byte
}

func (CheckIsEqualBytes) Check

func (c CheckIsEqualBytes) Check(v []byte) CheckOutput

type CheckIsJSONEqual

type CheckIsJSONEqual struct {
	Value interface{}
}

func (*CheckIsJSONEqual) Check

func (c *CheckIsJSONEqual) Check(v []byte) CheckOutput

type CheckIsTarFile

type CheckIsTarFile struct {
	// contains filtered or unexported fields
}

func IsTarFile

func IsTarFile() *CheckIsTarFile

func (*CheckIsTarFile) Check

func (c *CheckIsTarFile) Check(v []byte) CheckOutput

func (*CheckIsTarFile) HasFile

func (c *CheckIsTarFile) HasFile(format string, a ...interface{}) *CheckIsTarFile

func (*CheckIsTarFile) HasFileWithContent

func (c *CheckIsTarFile) HasFileWithContent(fileName, content string) *CheckIsTarFile

type CheckNot

type CheckNot[T any] struct {
	// contains filtered or unexported fields
}

func (CheckNot[T]) Check

func (c CheckNot[T]) Check(v T) CheckOutput

type CheckOutput

type CheckOutput struct {
	Success bool
	Reason  string
	Err     error
	Hint    string
}

func CidArrayEquals

func CidArrayEquals(a, b []cid.Cid) CheckOutput

func CidOrderedSubsetContains

func CidOrderedSubsetContains(a, b []cid.Cid) CheckOutput

func CidSetContains

func CidSetContains(a, b []cid.Cid) CheckOutput

func CidSetEquals

func CidSetEquals(a, b []cid.Cid) CheckOutput

type CheckRegexpMatch

type CheckRegexpMatch struct {
	Value *regexp.Regexp
}

func (*CheckRegexpMatch) Check

func (c *CheckRegexpMatch) Check(v string) CheckOutput

type CheckUniqAnd

type CheckUniqAnd struct {
	// contains filtered or unexported fields
}

func (*CheckUniqAnd) Check

func (c *CheckUniqAnd) Check(v []string) CheckOutput

type CheckWithHint

type CheckWithHint[T any] struct {
	Check_ Check[T]
	Hint   string
}

func Checks

func Checks[T any](hint string, f func(T) bool) CheckWithHint[T]

func ContainsWithHint

func ContainsWithHint(hint string, value string, rest ...any) CheckWithHint[string]

func IsEqualWithHint

func IsEqualWithHint(hint string, value string, rest ...any) CheckWithHint[string]

func WithHint

func WithHint[T any](hint string, check Check[T]) CheckWithHint[T]

func (CheckWithHint[T]) Check

func (c CheckWithHint[T]) Check(v T) CheckOutput

Jump to

Keyboard shortcuts

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