shared

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Disabled

func Disabled(msg pgs.Message) (disabled bool, err error)

Disabled returns true if validations are disabled for msg

func Has

func Has(msg proto.Message, fld string) bool

Has returns true if the provided Message has the a field fld.

func Needs

func Needs(m pgs.Message, wk WellKnown) bool

Needs returns true if a well-known string validator is needed for this message.

func RegisterFunctions

func RegisterFunctions(tpl *template.Template, params pgs.Parameters)

func Render

func Render(tpl *template.Template) func(ctx RuleContext) (string, error)

func RequiredOneOf

func RequiredOneOf(oo pgs.OneOf) (required bool, err error)

RequiredOneOf returns true if the oneof field requires a field to be set

Types

type Gogo

type Gogo struct {
	Nullable    bool
	StdDuration bool
	StdTime     bool
}

type RuleContext

type RuleContext struct {
	Field        pgs.Field
	Rules        proto.Message
	MessageRules *validate.MessageRules
	Gogo         Gogo

	Typ        string
	WrapperTyp string

	OnKey            bool
	Index            string
	AccessorOverride string
}

func (RuleContext) Elem

func (ctx RuleContext) Elem(name, idx string) (out RuleContext, err error)

func (RuleContext) Key

func (ctx RuleContext) Key(name, idx string) (out RuleContext, err error)

func (RuleContext) Unwrap

func (ctx RuleContext) Unwrap(name string) (out RuleContext, err error)

type WellKnown

type WellKnown string
const (
	Email    WellKnown = "email"
	Hostname WellKnown = "hostname"
	UUID     WellKnown = "uuid"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL