keycheck

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 3 Imported by: 0

README

keycheck-go

Go Reference Go Report Card GitHub License

A simple validator suitable for simple tasks inspired from OpenBullet's KeyCheck feature

Installation

Use go get -u command:

go get -u github.com/colduction/keycheck-go

Documentation

Index

Constants

View Source
const (
	NOT BitwiseID = iota // Bitwise NOT
	AND                  // Bitwise AND
	OR                   // Bitwise OR
	XOR                  // Bitwise XOR (exclusive OR)

	SUCCESS ID = "SUCCESS"
	FAIL    ID = "FAIL"
	INVALID ID = "INVALID"
	CUSTOM  ID = "CUSTOM"
	RETRY   ID = "RETRY"
	BAN     ID = "BAN"
	NONE    ID = "NONE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BitwiseID

type BitwiseID uint8 // Bitwise Operator ID

func (BitwiseID) IsValid

func (bi BitwiseID) IsValid() bool

IsValid checks if the BitwiseID is a defined operator.

type ID

type ID string

type KeyChain

type KeyChain[T any] interface {
	DelValidator(label ID) error
	GetValidator(label ID) (func(a T) (bool, error), error)
	Reset()
	SetCondition(condition BitwiseID) error
	SetValidator(label ID, fn func(a T) (bool, error)) error
	Validate(data T, defaultLabel ID) (ID, bool, []error)
}

func NewKeyChain

func NewKeyChain[T any](condition BitwiseID) (KeyChain[T], error)

NewKeyChain creates and returns a new KeyChain instance with a specified bitwise condition for validation logic. It returns an error if the condition is invalid.

Jump to

Keyboard shortcuts

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