chacha

package
v0.0.131 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package chacha provides primitives and functions to create a complex tree of checks when one check depends on another check

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DontCheckChildrens

type DontCheckChildrens struct{}

DontCheckChildrens a special marker that stops checking child branches

type Tree

type Tree struct {
	Validator Validator
	Data      interface{}
	Result    error
	Valid     bool
	Childrens []Tree
}

Tree describes the validation tree

func (*Tree) CheckChildrens

func (t *Tree) CheckChildrens() bool

CheckChildrens returns a flag - whether it is necessary to perform checks of child branches

func (*Tree) ShowErrors

func (t *Tree) ShowErrors()

ShowErrors display validation errors on the screen

func (*Tree) Validate

func (t *Tree) Validate(params ...interface{})

Validate Recursive function - traverses all branches of the validation tree and calls the validator function. The result of the check is saved in the Valid field.

type Validator

type Validator func(params ...interface{}) (interface{}, error)

Validator describes the validation function

Jump to

Keyboard shortcuts

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