Skip to content

debug-ing/validation-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

validation-go

This project is a simple system for validating user inputs in Go. It allows you to define rules for fields and validate that data meets certain conditions. It provides easy-to-understand error messages for invalid inputs.

This project is currently in development, and additional features will be added soon, including more validation rules and improved error handling. Future updates may include support for more complex validation scenarios, extended field types, and greater flexibility in customization.

Stay tuned for upcoming enhancements!

Strings:

Tag Description
boolean Boolean
contains Contains
notcontains not Contains
numeric Numeric

Network:

Tag Description
ip Internet Protocol Address IP
ipv4 Internet Protocol Address IPv4
ipv6 Internet Protocol Address IPv6
mac Media Access Control Address MAC
uri URI String
url URL String

Other:

Tag Description
required Required
optional Optional

Add Custom Validator:

validation.AddCustomValidator("test", "%s vard kon", validateRequired)

func validateRequired(value string, errorMsg string) error {
	if value == "" {
		fmt.Println(errorMsg)
		return errors.New(errorMsg)
	}
	return nil
}

more

I developed this project to deepen my understanding of Go and its capabilities. It's an opportunity for me to explore Go's features and enhance my skills in building more efficient and flexible systems.

Missing

  • Add Unit tests.

About

This is an initial project for validation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages