plugin

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

The validator plugin generates a Validate method for each message. By default, if none of the message's fields are annotated with the gogo validator annotation, it returns a nil. In case some of the fields are annotated, the Validate function returns nil upon sucessful validation, or an error describing why the validation failed. The Validate method is called recursively for all submessage of the message.

TODO(michal): ADD COMMENTS.

Equal is enabled using the following extensions:

  • equal
  • equal_all

While VerboseEqual is enable dusing the following extensions:

  • verbose_equal
  • verbose_equal_all

The equal plugin also generates a test given it is enabled using one of the following extensions:

  • testgen
  • testgen_all

Let us look at:

github.com/gogo/protobuf/test/example/example.proto

Btw all the output can be seen at:

github.com/gogo/protobuf/test/example/*

The following message:

given to the equal plugin, will generate the following code:

and the following test code:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPlugin

func NewPlugin(useGogoImport bool) generator.Plugin

Types

This section is empty.

Jump to

Keyboard shortcuts

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