internal

package
v0.0.0-...-d095f68 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileName = "service.pb.go"
)

Variables

View Source
var Partials = []string{
	convertersPartial,
	validatorsPartial,
	mutatorsPartial,
	handlersPartial,
	implsPartial,
}

Functions

func NewErrBadServiceImportPath

func NewErrBadServiceImportPath(file *protogen.File, importPath, fileImportPath string) error

func NewErrCreateField

func NewErrCreateField(f *Field, msg *Message, err error) error

func NewErrCreateService

func NewErrCreateService(svc *Service, err error) error

func NewErrEnumValueNotFound

func NewErrEnumValueNotFound(enumValueName string, f *Field) error

func NewErrFieldNotFound

func NewErrFieldNotFound(fieldName string, msg *Message) error

func NewErrInvalidRuleForField

func NewErrInvalidRuleForField(f *Field, ruleName string) error

func NewErrInvalidRuleIn

func NewErrInvalidRuleIn(f *Field, value string) error

func NewErrInvalidServiceImportPath

func NewErrInvalidServiceImportPath(file *protogen.File, importPath string) error

func NewErrMessageNotFound

func NewErrMessageNotFound(messageName string, svc *Service) error

func NewErrMethodNotFound

func NewErrMethodNotFound(methodName string, svc *Service) error

func NewErrPrivatePackageNotFound

func NewErrPrivatePackageNotFound(name protoreflect.FullName) error

func NewRules

func NewRules(f *Field, validate *svc.Validate) ([]string, error)

Types

type EnumValue

type EnumValue struct {
	IsLatest     bool
	IsDeprecated bool
	IsPrivate    bool
	Name         string
	Next         *EnumValue
	Private      *EnumValue
	Receive      []*EnumValue
}

func NewEnumValue

func NewEnumValue(f *Field, value *protogen.EnumValue) (*EnumValue, error)

NewEnumValue creates a `EnumValue`. An error will be returned if the enum value cannot be created for any reason.

func (*EnumValue) NextType

func (v *EnumValue) NextType() string

func (*EnumValue) PrivateType

func (v *EnumValue) PrivateType() string

func (*EnumValue) Type

func (v *EnumValue) Type() string

type Field

type Field struct {
	IsPrivate       bool
	IsLatest        bool
	IsDeprecated    bool
	IsMessage       bool
	IsEnum          bool
	IsOneOf         bool
	IsMatch         bool
	IsRepeated      bool
	IsRequired      bool
	Name            string
	EnumName        string
	Type            Type
	Private         *Field
	Next            *Field
	Message         *Message
	Messages        []*Message
	EnumValues      []*EnumValue
	EnumValueByName map[string]*EnumValue
	Rules           []string
}

func NewField

func NewField(svc *Service, msg *Message, field *protogen.Field) (*Field, error)

NewField creates a `Field`. An error will be returned if the field cannot be created for any reason.

func NewOneOf

func NewOneOf(svc *Service, msg *Message, oneof *protogen.Oneof) (*Field, error)

NewOneOf creates a `OneOf`. An error will be returned if the oneof cannot be created for any reason.

type Message

type Message struct {
	IsPrivate        bool
	IsLatest         bool
	IsDeprecated     bool
	IsExternal       bool
	IsOneOf          bool
	IsConverterEmpty bool
	IsMatch          bool
	IsInput          bool
	Name             string
	MethodName       string
	ImportPath       string
	PackageName      string
	FullName         string
	Private          *Message
	Next             *Message
	Parent           *Message
	Fields           []*Field
	FieldByName      map[string]*Field
}

func NewExternalMessage

func NewExternalMessage(svc *Service, message *protogen.Message) (*Message, error)

NewExternalMessage creates a `Message` for protobuf messages that are external to the public and private services. These are placeholder structures to make building validators and converters easier.

func NewMessage

func NewMessage(svc *Service, message, parent *protogen.Message) (*Message, error)

NewMessage creates a `Message`. An error will be returned if the message cannot be created for any reason.

func NewMethodExternalMessage

func NewMethodExternalMessage(svc *Service, method *protogen.Method, message *protogen.Message, isInput bool) *Message

func (*Message) NextType

func (m *Message) NextType() string

func (*Message) PrivateType

func (m *Message) PrivateType() string

func (*Message) Ref

func (m *Message) Ref() string

func (*Message) Type

func (m *Message) Type() string

type Method

type Method struct {
	IsPrivate        bool
	IsLatest         bool
	IsDeprecated     bool
	IsConverterEmpty bool
	Name             string
	Private          *Method
	Next             *Method
	Input            *Message
	Output           *Message
}

func NewMethod

func NewMethod(svc *Service, method *protogen.Method, input, output *Message) (*Method, error)

NewMethod creates a `Method`. An error will be returned if the method cannot be created for any reason.

type Package

type Package struct {
	ProtoName         protoreflect.FullName
	Name              protogen.GoPackageName
	ImportPath        protogen.GoImportPath
	ServiceImportPath protogen.GoImportPath
	Service           *protogen.Service
	Messages          []*protogen.Message
}

type PartialNamer

type PartialNamer interface {
	PartialName() string
}

type Plugin

type Plugin struct {
	Verbose            bool
	PrivatePackageName string
}

func (*Plugin) Run

func (p *Plugin) Run(plugin *protogen.Plugin) error

type RegisterService

type RegisterService struct {
	PackageName string
	Services    []*Service
	Private     *Service
}

type Service

type Service struct {
	IsPrivate            bool
	IsLatest             bool
	ProtoPackageName     string
	PackageName          string
	ImportPath           string
	ServiceImportPath    string
	SubServiceImportPath string
	GeneratedFileName    string
	Name                 string
	Private              *Service
	Next                 *Service
	Messages             []*Message
	MessageByName        map[string]*Message
	Methods              []*Method
	MethodByName         map[string]*Method
}

func NewService

func NewService(
	protoPackageName protoreflect.FullName,
	packageName protogen.GoPackageName,
	importPath protogen.GoImportPath,
	serviceImportPath protogen.GoImportPath,
	service *protogen.Service,
	messages []*protogen.Message,
	serviceChain []*Service,
) (*Service, error)

NewService creates a `Service`. An error will be returned if the service cannot be created for any reason.

type Type

type Type int
const (
	Undefined Type = iota
	StringType
	Int64Type
	Uint64Type
	Float64Type
	BooleanType
	BytesType
	MessageType
	EnumType
	OneOfType
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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