https://github.com/leonsteinhaeuser/go-compare
A library that can compare data types based on different "match" criterias.
https://github.com/leonsteinhaeuser/go-compare
Last synced: 9 months ago
JSON representation
A library that can compare data types based on different "match" criterias.
- Host: GitHub
- URL: https://github.com/leonsteinhaeuser/go-compare
- Owner: leonsteinhaeuser
- License: mit
- Created: 2021-12-27T14:14:46.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-02-16T23:08:46.000Z (over 3 years ago)
- Last Synced: 2024-06-20T03:46:23.096Z (about 2 years ago)
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-diff
[](https://github.com/leonsteinhaeuser/go-compare/actions/workflows/unit-tests.yml)
[](https://codecov.io/gh/leonsteinhaeuser/go-compare)
A library that can compare data types based on different "match" criterias.
Supported match criterias:
- less than
- less than or equal
- greater than
- greater than or equal
- percentage deviation
- regex
- range
- equal
- not equal
- not empty
- contains
## Example
```go
func main() {
val := Validation{
MatchType: MatchTypeEqual
ExpectedValue: "foo",
}
isMatch, err := val.Matches("foo")
if err != nil {
panic(err)
}
fmt.Printf("Compared %q against %q and got %v", "foo", "foo", isMatch)
}
```