validators

package
v0.0.0-...-a44ad7e Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const IsDifficultyEnumValidator = "isdifficultyenum"

Variables

View Source
var IsDifficultyEnum validator.Func = func(fl validator.FieldLevel) bool {
	field := fl.Field()

	if field.Kind() == reflect.String {
		v := field.String()

		switch v {
		case string(game.BeginnerDifficulty):
			fallthrough
		case string(game.IntermediateDifficulty):
			fallthrough
		case string(game.ExpertDifficulty):
			return true
		default:
			return false
		}
	}

	return false
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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