{"id":25847631,"url":"https://github.com/devjefster/govalidator","last_synced_at":"2026-05-13T03:39:23.388Z","repository":{"id":276789966,"uuid":"930302113","full_name":"devjefster/GoValidator","owner":"devjefster","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-11T22:33:41.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-02T10:33:23.520Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devjefster.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-10T12:17:31.000Z","updated_at":"2025-10-02T03:30:20.000Z","dependencies_parsed_at":"2025-02-10T13:42:47.781Z","dependency_job_id":null,"html_url":"https://github.com/devjefster/GoValidator","commit_stats":null,"previous_names":["devjefster/beanvalidator"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/devjefster/GoValidator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjefster%2FGoValidator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjefster%2FGoValidator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjefster%2FGoValidator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjefster%2FGoValidator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devjefster","download_url":"https://codeload.github.com/devjefster/GoValidator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjefster%2FGoValidator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32967211,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T23:30:32.555Z","status":"online","status_checked_at":"2026-05-13T02:00:07.132Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-01T10:33:07.296Z","updated_at":"2026-05-13T03:39:23.375Z","avatar_url":"https://github.com/devjefster.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GoValidator 🚀\nA powerful and lightweight **struct validation library** for Go, inspired by Java's Bean Validation.\n\n---\n\n## **📌 Features**\n✅ **Simple and powerful validation rules**  \n✅ **Supports string, number, boolean, date, and collection validation**  \n✅ **Custom error messages**  \n✅ **Easy-to-use struct-based validation**\n\n---\n\n## **📌 Installation**\nTo use **GoValidator**, install it as a Go module:\n```sh\n  go get github.com/devjefster/GoValidator@latest\n```\n\n## 📌 Usage Example\n\nCreate a struct with validation tags and run the validator.\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/devjefster/GoValidator/validator\"\n)\n\ntype User struct {\n\tUsername      string   `validate:\"required,minSize=3,maxSize=15\"`\n\tEmail         string   `validate:\"required,email\"`\n\tAge           int      `validate:\"required,positive\"`\n\tBalance       float64  `validate:\"positiveOrZero\"`\n\tIsActive      bool     `validate:\"isTrue\"`\n\tTags          []string `validate:\"minSize=1,maxSize=5\"`\n\tBirthdate     string   `validate:\"date=2006-01-02,pastInclusive=2006-01-02\"`\n\tSubscription  string   `validate:\"date=2006-01-02,future=2006-01-02\"`\n\tPhoneNumbers  []string `validate:\"size=2\"`\n\tComment       string   `validate:\"maxSize=200\"`\n\tFavoriteItems []int    `validate:\"minSize=2\"`\n}\n\nfunc main() {\n\tuser := User{\n\t\tUsername:      \"johndoe\",\n\t\tEmail:         \"johndoe@example.com\",\n\t\tAge:           25,\n\t\tBalance:       100.50,\n\t\tIsActive:      true,\n\t\tTags:          []string{\"Go\", \"Golang\"},\n\t\tBirthdate:     \"1995-06-15\",\n\t\tSubscription:  \"2025-01-01\",\n\t\tPhoneNumbers:  []string{\"123-456-7890\", \"987-654-3210\"},\n\t\tComment:       \"This is a sample comment.\",\n\t\tFavoriteItems: []int{1, 2},\n\t}\n\n\terrors := validator.Validate(user)\n\n\tif errors.HasErrors() {\n\t\tfmt.Println(\"Validation failed:\")\n\t\tfor _, err := range errors {\n\t\t\tfmt.Println(\"-\", err)\n\t\t}\n\t} else {\n\t\tfmt.Println(\"Validation passed ✅\")\n\t}\n}\n\n````\n## 📌 Supported Validation Rules\n\n| Rule                   | Description                                            | Example                               |\n|------------------------|--------------------------------------------------------|---------------------------------------|\n| required               | Ensures the field is not empty or nil.                 | validate:\"required\"                   |\n| email                  | Ensures the field contains a valid email.              | validate:\"email\"                      |\n| isTrue                 | Ensures the field is true.                             | validate:\"isTrue\"                     |\n| positive               | Ensures the field is greater than 0.                   | validate:\"positive\"                   |\n| negative               | Ensures the field is less than 0.                      | validate:\"negative\"                   |\n| positiveOrZero         | Ensures the field is \u003e= 0.                             | validate:\"positiveOrZero\"             |\n| negativeOrZero         | Ensures the field is \u003c= 0.                             | validate:\"negativeOrZero\"             |\n| size=n                 | Ensures the collection has exactly n elements.         | validate:\"size=2\"                     |\n| minSize=n              | Ensures the collection has at least n elements.        | validate:\"minSize=2\"                  |\n| maxSize=n              | Ensures the collection has at most n elements.         | validate:\"maxSize=5\"                  |\n| date=format            | Ensures the field is a valid date in the given format. | validate:\"date=2006-01-02\"            |\n| past=format            | Ensures the field is a past date.                      | validate:\"past=2006-01-02\"            |\n| future=format          | Ensures the field is a future date.                    | validate:\"future=2006-01-02\"          |\n| pastInclusive=format   | Ensures the field is a past or present date.           | validate:\"pastInclusive=2006-01-02\"   |\n| futureInclusive=format | Ensures the field is a future or present date.         | validate:\"futureInclusive=2006-01-02\" |\n\n## 📌 Running Tests\n\nTo run all unit tests:\n````shell\n  go test -v ./...\n````\n## 📌 Contributions\n\nFeel free to fork, contribute, and open issues to improve this library! 🚀\n\n---\n\n### **✅ Summary**\n✅ **Detailed documentation with examples**  \n✅ **List of all supported validation rules**  \n✅ **Installation and test instructions**  \n✅ **Encourages contributions and improvements**\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevjefster%2Fgovalidator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevjefster%2Fgovalidator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevjefster%2Fgovalidator/lists"}