customval

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DateValidatorTag is the tag identifier for date validation (`validate:"date={formats}"`).
	DateValidatorTag = "date"

	// Supported date formats
	DateOnly = "dateonly" // DateOnly represents the 'dateonly' format (YYYY-MM-DD) (`validate:"date=dateonly"`).
	DateTime = "datetime" // DateTime represents the 'datetime' format (YYYY-MM-DD HH:MM:SS) (`validate:"date=datetime"`).
	RFC3339  = "rfc3339"  // RFC3339 represents the 'rfc3339' format (YYYY-MM-DDTHH:MM:SSZ, YYYY-MM-DDTHH:MM:SS±HH:MM) (`validate:"date=rfc3339"`).
	TimeOnly = "timeonly" // TimeOnly represents the 'timeonly' format (HH:MM:SS) (`validate:"date=timeonly"`).
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DateValidator

type DateValidator struct{}

DateValidator implements the CustomValidator interface for date validation.

func (*DateValidator) Func

func (*DateValidator) Func() validator.Func

Func returns the validation function for date validation.

func (*DateValidator) Tag

func (*DateValidator) Tag() string

Tag returns the tag identifier for the date validator.

func (*DateValidator) Translation

func (*DateValidator) Translation() (string, validator.TranslationFunc)

Translation returns the translation text and custom translation function for the date validator.

Jump to

Keyboard shortcuts

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