Skip to content
This repository has been archived by the owner on Jul 28, 2020. It is now read-only.

zhevron/go-validate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-validate - Object validation library

wercker status Coverage Status GoDoc

go-validate is an object validation library for Go.

For package documentation, refer to the GoDoc badge above.

Installation

go get gopkg.in/zhevron/go-validate.v0/validate

Usage

package main

import (
  "fmt"

  "gopkg.in/zhevron/go-validate.v0/validate"
)

type MyObject struct {
  String string `minLen:"10" maxLen:"50"`
  Int    int    `min:"5"`
  Error  error  `nil:"false"`
}

func main() {
  var obj MyObject

  if ok, errs := validate.Validate(obj); !ok {
    fmt.Println("The following validation errors occured:")

    for _, err := range errs {
      fmt.Printf("  %s\n", err.Error())
    }
  }
}

License

go-validate is licensed under the MIT license.

About

Object validation library for Google Go.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages