validation

command module
v0.0.0-...-838b099 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: MIT Imports: 6 Imported by: 0

README

Validation

The validator package provides validation against a variable value or against the values of the fields in a struct by declaring a "tag" that instruct the engine how we want to validate the value using some built-in rules. This recipe shows how we can use this package to perform value validation.

There are 2 parts in this recipe.

  • main.go - sample code of using the validator package.
  • *_test.go - a set of test cases that show the different validation tags - good sample code to see the extent/richness of supported validation rules that are provided by the package.

Setup

  1. Run the sample code.

    $ make run
    
  2. Run (via test) to see the validation rules in action.

    $ make test
    
  3. Run both at the same time.

    $ make
    

Reference

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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