You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Package ozzo_rules provides a comprehensive set of additional validation rules for use with the ozzo-validation package. It extends the standard validation capabilities with specialized validators for geographic data, contact information, identity verification, network addresses, and region-specific formats, all optimized with LRU caching for enhanced performance.
This package was originally developed as an internal project at Altessa Solutions Inc. and is now open-sourced under the MIT License.
AI tools were used during the open-source transition for: creating GitHub workflows and configuration files, updating and consolidating documentation, generating usage examples, and reviewing code for consistency.
API Reference
Core Types
Type
Description
Rule
Common interface for all validation rules
Geographic Validators
Rule
Description
CountryCode2() CountryCode2Rule
Validates ISO 3166-1 alpha-2 country codes
LangCode2() LangCode2Rule
Validates ISO 639-1 language codes
ZipCode() ZipCodeRule
Validates international postal codes using the postcode library
Timezone() TimezoneRule
Validates IANA timezone database names
Contact Information Validators
Rule
Description
Phone(countryCode string) PhoneRule
Validates international phone numbers using Google's libphonenumber
Identity Validators
Rule
Description
Username() UsernameRule
Validates usernames with alphanumeric, underscore, and hyphen characters
Password() PasswordRule
Validates password strength with configurable requirements
Date/Time Validators
Rule
Description
Birthdate() BirthdateRule
Validates birthdates in YYYY-MM-DD format
Timestamp() TimestampRule
Validates Unix timestamps (seconds since epoch)
Duration() DurationRule
Validates Go duration strings (e.g., "1h30m", "5s")
DurationLimit(min, max time.Duration) DurationLimitRule