validators

package
v0.0.98 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package validators contains the validation functions for the application. these specificially relate to the prompts/questions asked to the user and validating the user input.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtleastOne

func AtleastOne[T any](v []T) error

AtleastOne validates that atleast one selection is required.

func NotZero

func NotZero[T comparable](v T) error

NotZero validates that the value is not zero. It returns an error if the value is zero.

Types

type Validator

type Validator[T any] func(v T) error

func Combine

func Combine[T any](validators ...Validator[T]) Validator[T]

func MaxLength

func MaxLength[T any](m int) Validator[T]

MaxLength validates that the value is at most m long.

Supported Types:

  • string
  • slice
  • array
  • map
  • channel

func MinLength

func MinLength[T any](m int) Validator[T]

MinLength validates that the value is atleast m long.

Supported Types:

  • string
  • slice
  • array
  • map
  • channel

Jump to

Keyboard shortcuts

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