An open API service indexing awesome lists of open source software.

https://github.com/webermarci/validator

It's a simple string validator
https://github.com/webermarci/validator

go golang string-validation stringvalidator

Last synced: about 1 month ago
JSON representation

It's a simple string validator

Awesome Lists containing this project

README

          

# Validator

## Usage

```go
import "github.com/webermarci/validator"

v := validator.NewValidator().StartsWith("123")

result := v.Validate("abc123")

fmt.Println(result.Approval)
// False

fmt.Println(result.RuleType)
// startsWith

fmt.Println(result.Reason)
// "starts with 123" is not met by "abc123"

result = v.Validate("123abc")

fmt.Println(result.Approval)
// True
```