go-playground-converter

command module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: MIT Imports: 7 Imported by: 50

README

Go Playground Converter

GitHub go.mod Go version GitHub GitHub issues GitHub closed issues GitHub contributors

go-playground-converter is formatter error response inspiration like express-validator in nodejs build on top in go-playground-validator, see more about struct reference follow this.

Installation

$ go get -u github.com/restuwahyu13/go-playground-converter

Example Usage

  package main

  import (
  "fmt"
   gpc "github.com/restuwahyu13/go-playground-converter"
  )

  type Login struct {
  	Email    string `validate:"required,email"`
  	Password string `validate:"required"`
  }

  func main() {
   	payload := Login{Email: "", Password: ""}
  		err := Validator(payload)
  		fmt.Println(err.Errors) // if not errors validator return nil value
  }

  // {
  //   "errors": [
  //     {
  //       "msg": "Email is a required field",
  //       "param": "Email",
  //       "tag": "required"
  //     },
  //     {
  //       "msg": "Password is a required field",
  //       "param": "Password",
  //       "tag": "required"
  //     }
  //   ]
  // }

Bugs

For information on bugs related to package libraries, please visit here

Contributing

Want to make Go Playground Converter more perfect ? Let's contribute and follow the contribution guide.

License

BACK TO TOP

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