Skip to content
Node: z.string().email()github.com/sahilkhaire/gox/validate

String

Overview

If you are coming from Node.js, the closest pattern is z.string().email().

Signature

go
func String() *stringField

Compare: Node.js · Standard Go · gox

js
z.string().email()
go
field := validate.String().Email() // fluent schema builder
go
import "github.com/sahilkhaire/gox/validate"

field := validate.String().Required().Email().MinLen(3)

Example

go
import "github.com/sahilkhaire/gox/validate"

field := validate.String().Required().Email().MinLen(3)

Tips

Import github.com/sahilkhaire/gox/validate and call String directly. See the comparison below for the standard library equivalent.

Standard library alternative

Use the standard library directly:

go
field := validate.String().Email() // fluent schema builder

Back to validate package overview

MIT Licensed · Built for Node.js developers moving to Go