validate
Package validate provides Zod/Joi-like validation on top of go-playground/validator. Node equivalent: zod, joi, yup
import "github.com/sahilkhaire/gox/validate"
Select a symbol below — each page explains what it does, shows Node.js vs Go comparisons, and includes a runnable example.
Functions
| Symbol | Node.js | Kind | Summary |
|---|---|---|---|
| Array | — | func | |
| Bool | — | func | |
| Float | — | func | |
| Int | z.number().min(18) | func | |
| MustValidate | — | func | MustValidate panics if validation fails. |
| ObjectField | — | func | ObjectField nests an object schema as a field. |
| ParseJSON | — | func | ParseJSON decodes JSON from r into v and validates struct tags on v. |
| String | z.string().email() | func | |
| Validate | — | func | Validate runs struct-tag validation on structs. |
| ValidateSchema | schema.parse(data) | func | ValidateSchema validates v against sch (map or struct). |
Types
| Symbol | Node.js | Kind | Summary |
|---|---|---|---|
| Field | — | type | Field validates a single value in a programmatic schema. |
| Schema | — | type | Schema is a map-based object schema (Joi.object). |
| ValidationError | — | type | ValidationError holds human-readable validation messages. |
Methods
| Symbol | Node.js | Kind | Summary |
|---|---|---|---|
| Schema.Object | z.object({...}) | method | Object builds a schema from field definitions. |