validation

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyValidator

type APIKeyValidator struct {
	Required  bool
	MinLength int
	MaxLength int
}

APIKeyValidator validates API key strings

func (*APIKeyValidator) Validate

func (v *APIKeyValidator) Validate(value interface{}) error

type IntervalValidator

type IntervalValidator struct {
	Required    bool
	MinDuration int // in minutes
	MaxDuration int // in minutes
}

IntervalValidator validates interval strings (e.g., "1h", "30m")

func (*IntervalValidator) Validate

func (v *IntervalValidator) Validate(value interface{}) error

type LimitValidator

type LimitValidator struct {
	Required bool
	Min      int
	Max      int
}

LimitValidator validates content limit integers

func (*LimitValidator) Validate

func (v *LimitValidator) Validate(value interface{}) error

type PeriodValidator

type PeriodValidator struct {
	Required bool
}

PeriodValidator validates period strings (weekly, monthly, yearly, all)

func (*PeriodValidator) GetValidPeriods

func (v *PeriodValidator) GetValidPeriods() []string

func (*PeriodValidator) Validate

func (v *PeriodValidator) Validate(value interface{}) error

type URLValidator

type URLValidator struct {
	Required bool
	Schemes  []string // allowed schemes (http, https)
}

URLValidator validates URL strings

func (*URLValidator) Validate

func (v *URLValidator) Validate(value interface{}) error

type ValidationError

type ValidationError struct {
	Field   string
	Message string
}

ValidationError represents a validation error

func (*ValidationError) Error

func (e *ValidationError) Error() string

type Validator

type Validator interface {
	Validate(value interface{}) error
}

Validator interface for all validators

Jump to

Keyboard shortcuts

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