resolver

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultRetryMaxRetryCount = uint64(5)

	DefaultRetryConstantInterval = time.Second

	DefaultRetryExponentialInitialInterval     = 500 * time.Millisecond
	DefaultRetryExponentialRandomizationFactor = float64(0.5)
	DefaultRetryExponentialMultiplier          = float64(1.5)
	DefaultRetryExponentialMaxInterval         = 60 * time.Second
)
View Source
var (
	DoubleType           = &Type{Kind: types.Double}
	FloatType            = &Type{Kind: types.Float}
	Int32Type            = &Type{Kind: types.Int32}
	Int64Type            = &Type{Kind: types.Int64}
	Uint32Type           = &Type{Kind: types.Uint32}
	Uint64Type           = &Type{Kind: types.Uint64}
	Sint32Type           = &Type{Kind: types.Sint32}
	Sint64Type           = &Type{Kind: types.Sint64}
	Fixed32Type          = &Type{Kind: types.Fixed32}
	Fixed64Type          = &Type{Kind: types.Fixed64}
	Sfixed32Type         = &Type{Kind: types.Sfixed32}
	Sfixed64Type         = &Type{Kind: types.Sfixed64}
	BoolType             = &Type{Kind: types.Bool}
	StringType           = &Type{Kind: types.String}
	BytesType            = &Type{Kind: types.Bytes}
	EnumType             = &Type{Kind: types.Enum}
	EnvType              = &Type{Kind: types.String}
	DoubleRepeatedType   = &Type{Kind: types.Double, Repeated: true}
	FloatRepeatedType    = &Type{Kind: types.Float, Repeated: true}
	Int32RepeatedType    = &Type{Kind: types.Int32, Repeated: true}
	Int64RepeatedType    = &Type{Kind: types.Int64, Repeated: true}
	Uint32RepeatedType   = &Type{Kind: types.Uint32, Repeated: true}
	Uint64RepeatedType   = &Type{Kind: types.Uint64, Repeated: true}
	Sint32RepeatedType   = &Type{Kind: types.Sint32, Repeated: true}
	Sint64RepeatedType   = &Type{Kind: types.Sint64, Repeated: true}
	Fixed32RepeatedType  = &Type{Kind: types.Fixed32, Repeated: true}
	Fixed64RepeatedType  = &Type{Kind: types.Fixed64, Repeated: true}
	Sfixed32RepeatedType = &Type{Kind: types.Sfixed32, Repeated: true}
	Sfixed64RepeatedType = &Type{Kind: types.Sfixed64, Repeated: true}
	BoolRepeatedType     = &Type{Kind: types.Bool, Repeated: true}
	StringRepeatedType   = &Type{Kind: types.String, Repeated: true}
	BytesRepeatedType    = &Type{Kind: types.Bytes, Repeated: true}
	EnumRepeatedType     = &Type{Kind: types.Enum, Repeated: true}
	EnvRepeatedType      = &Type{Kind: types.String, Repeated: true}
)
View Source
var DefaultProtoFormatOption = &ProtoFormatOption{IndentSpaceNum: 2}

Functions

func DependencyGraphTreeFormat

func DependencyGraphTreeFormat(groups []VariableDefinitionGroup) string

func ExtractIndividualErrors

func ExtractIndividualErrors(err error) []error

ExtractIndividualErrors extracts all error instances from Error type.

func IsGRPCFederationGeneratedFile added in v0.4.0

func IsGRPCFederationGeneratedFile(path string) bool

func ToCELType added in v0.2.0

func ToCELType(typ *Type) *cel.Type

Types

type AllMessageDependencyGraph added in v0.3.0

type AllMessageDependencyGraph struct {
	Roots []*AllMessageDependencyGraphNode
}

func CreateAllMessageDependencyGraph added in v0.3.0

func CreateAllMessageDependencyGraph(ctx *context, msgs []*Message) *AllMessageDependencyGraph

CreateAllMessageDependencyGraph creates a dependency graph for all messages with message options defined.

type AllMessageDependencyGraphNode added in v0.3.0

type AllMessageDependencyGraphNode struct {
	Parent   []*AllMessageDependencyGraphNode
	Children []*AllMessageDependencyGraphNode
	Message  *Message
}

type AllMessageDependencyGraphNodeReferenceBuilder added in v0.13.0

type AllMessageDependencyGraphNodeReferenceBuilder struct {
	// contains filtered or unexported fields
}

func (*AllMessageDependencyGraphNodeReferenceBuilder) Build added in v0.13.0

func (b *AllMessageDependencyGraphNodeReferenceBuilder) Build(ctx *context)

type Argument

type Argument struct {
	Name  string
	Type  *Type
	Value *Value
}

func (*Argument) ProtoFormat

func (a *Argument) ProtoFormat(opt *ProtoFormatOption, isRequestArg bool) string

type AutoBindField

type AutoBindField struct {
	VariableDefinition *VariableDefinition
	Field              *Field
}

func (*AutoBindField) ProtoFormat

func (f *AutoBindField) ProtoFormat(opt *ProtoFormatOption) string

type BadRequest added in v0.5.2

type BadRequest struct {
	FieldViolations []*BadRequestFieldViolation
}

type BadRequestFieldViolation added in v0.5.2

type BadRequestFieldViolation struct {
	Field       *CELValue
	Description *CELValue
}

type CELFunction added in v0.10.0

type CELFunction struct {
	Name     string
	ID       string
	Args     []*Type
	Return   *Type
	Receiver *Message
}

func (*CELFunction) CELArgs added in v0.10.0

func (f *CELFunction) CELArgs() []*cel.Type

func (*CELFunction) CELReturn added in v0.10.0

func (f *CELFunction) CELReturn() *cel.Type

type CELPlugin added in v0.10.0

type CELPlugin struct {
	Name      string
	Desc      string
	Functions []*CELFunction
}

func (*CELPlugin) CompileOptions added in v0.10.0

func (plugin *CELPlugin) CompileOptions() []cel.EnvOption

func (*CELPlugin) LibraryName added in v0.10.0

func (plugin *CELPlugin) LibraryName() string

func (*CELPlugin) ProgramOptions added in v0.10.0

func (plugin *CELPlugin) ProgramOptions() []cel.ProgramOption

type CELRegistry added in v0.2.0

type CELRegistry struct {
	*celtypes.Registry
	// contains filtered or unexported fields
}

func (*CELRegistry) FindStructFieldType added in v0.2.0

func (r *CELRegistry) FindStructFieldType(structType, fieldName string) (*celtypes.FieldType, bool)

func (*CELRegistry) LookupEnum added in v0.2.0

func (r *CELRegistry) LookupEnum(t *celtypes.Type) (*Enum, bool)

func (*CELRegistry) RegisterFiles added in v0.2.0

func (r *CELRegistry) RegisterFiles(files ...*descriptorpb.FileDescriptorProto) error

type CELValue added in v0.2.0

type CELValue struct {
	Expr              string
	Out               *Type
	CheckedExpr       *exprv1.CheckedExpr
	UseContextLibrary bool
}

func (*CELValue) ReferenceNames added in v0.3.0

func (v *CELValue) ReferenceNames() []string

type CallExpr added in v0.6.0

type CallExpr struct {
	Method  *Method
	Request *Request
	Timeout *time.Duration
	Retry   *RetryPolicy
	Errors  []*GRPCError
}

func (*CallExpr) MarkUsed added in v0.13.0

func (e *CallExpr) MarkUsed(nameRefMap map[string]struct{})

func (*CallExpr) MessageExprs added in v0.13.0

func (e *CallExpr) MessageExprs() []*MessageExpr

func (*CallExpr) MessageToDefsMap added in v0.13.0

func (e *CallExpr) MessageToDefsMap() map[*Message]VariableDefinitions

func (*CallExpr) ProtoFormat added in v0.6.0

func (e *CallExpr) ProtoFormat(opt *ProtoFormatOption) string

func (*CallExpr) ReferenceNames added in v0.6.0

func (e *CallExpr) ReferenceNames() []string

type ConcurrentVariableDefinitionGroup added in v0.10.0

type ConcurrentVariableDefinitionGroup struct {
	Starts []VariableDefinitionGroup
	End    *VariableDefinition
}

func (*ConcurrentVariableDefinitionGroup) Type added in v0.10.0

func (*ConcurrentVariableDefinitionGroup) VariableDefinitions added in v0.10.0

func (g *ConcurrentVariableDefinitionGroup) VariableDefinitions() VariableDefinitions

type ConstValue added in v0.2.0

type ConstValue struct {
	Type  *Type
	Value interface{}
}

func (*ConstValue) ProtoFormat added in v0.2.0

func (c *ConstValue) ProtoFormat(opt *ProtoFormatOption) string

type CustomResolver

type CustomResolver struct {
	Message *Message
	Field   *Field
}

func (*CustomResolver) FQDN added in v0.1.1

func (r *CustomResolver) FQDN() string

type Enum

type Enum struct {
	File    *File
	Name    string
	Values  []*EnumValue
	Message *Message
	Rule    *EnumRule
}

func (*Enum) FQDN

func (e *Enum) FQDN() string

func (*Enum) GoPackage

func (e *Enum) GoPackage() *GoPackage

func (*Enum) HasValue

func (e *Enum) HasValue(name string) bool

func (*Enum) Package

func (e *Enum) Package() *Package

func (*Enum) PackageName

func (e *Enum) PackageName() string

func (*Enum) Value

func (e *Enum) Value(name string) *EnumValue

type EnumRule

type EnumRule struct {
	Alias *Enum
}

type EnumValue

type EnumValue struct {
	Value string
	Enum  *Enum
	Rule  *EnumValueRule
}

func (*EnumValue) FQDN

func (v *EnumValue) FQDN() string

type EnumValueRule

type EnumValueRule struct {
	Default bool
	Aliases []*EnumValue
}

type EnvKey

type EnvKey string

type Error

type Error struct {
	Errs []error
}

Error represents resolver package's error. this has multiple error instances from resolver.

func (*Error) Error

func (e *Error) Error() string

type Field

type Field struct {
	Name    string
	Type    *Type
	Oneof   *Oneof
	Rule    *FieldRule
	Message *Message
}

func (*Field) FQDN added in v0.12.0

func (f *Field) FQDN() string

func (*Field) HasCustomResolver

func (f *Field) HasCustomResolver() bool

func (*Field) HasMessageCustomResolver

func (f *Field) HasMessageCustomResolver() bool

func (*Field) HasRule

func (f *Field) HasRule() bool

func (*Field) RequiredTypeConversion

func (f *Field) RequiredTypeConversion() bool

func (*Field) SourceType

func (f *Field) SourceType() *Type

func (*Field) TypeConversionDecls

func (f *Field) TypeConversionDecls() []*TypeConversionDecl

type FieldOneofRule added in v0.3.0

type FieldOneofRule struct {
	If      *CELValue
	Default bool
	By      *CELValue
	DefSet  *VariableDefinitionSet
}

FieldOneofRule represents grpc.federation.field.oneof.

type FieldRule

type FieldRule struct {
	// Value value to bind to field.
	Value *Value
	// CustomResolver whether `custom_resolver = true` is set in grpc.federation.field option.
	CustomResolver bool
	// MessageCustomResolver whether `custom_resolver = true` is set in grpc.federation.message option.
	MessageCustomResolver bool
	// Alias valid if `alias` is specified in grpc.federation.field option.
	Alias *Field
	// AutoBindField valid if `autobind = true` is specified in resolver.response of grpc.federation.message option.
	AutoBindField *AutoBindField
	// Oneof represents oneof for field option.
	Oneof *FieldOneofRule
}

func (*FieldRule) ProtoFormat

func (r *FieldRule) ProtoFormat(opt *ProtoFormatOption) string

type File

type File struct {
	Package     *Package
	GoPackage   *GoPackage
	Name        string
	Desc        *descriptorpb.FileDescriptorProto
	ImportFiles []*File
	Services    []*Service
	Messages    []*Message
	Enums       []*Enum
	CELPlugins  []*CELPlugin
}

func (*File) AllEnums added in v0.13.1

func (f *File) AllEnums() []*Enum

func (*File) HasServiceWithRule added in v0.4.0

func (f *File) HasServiceWithRule() bool

func (*File) Message

func (f *File) Message(name string) *Message

func (*File) PackageName

func (f *File) PackageName() string

type Files

type Files []*File

func (Files) FindByPackageName

func (f Files) FindByPackageName(pkg string) Files

type GRPCError added in v0.13.0

type GRPCError struct {
	DefSet            *VariableDefinitionSet
	If                *CELValue
	Code              code.Code
	Message           *CELValue
	Details           GRPCErrorDetails
	Ignore            bool
	IgnoreAndResponse *CELValue
}

func (*GRPCError) DefinitionGroups added in v0.13.0

func (e *GRPCError) DefinitionGroups() []VariableDefinitionGroup

func (*GRPCError) MarkUsed added in v0.13.0

func (e *GRPCError) MarkUsed(nameRefMap map[string]struct{})

func (*GRPCError) MessageExprs added in v0.13.0

func (e *GRPCError) MessageExprs() []*MessageExpr

func (*GRPCError) MessageToDefsMap added in v0.13.0

func (e *GRPCError) MessageToDefsMap() map[*Message]VariableDefinitions

func (*GRPCError) ProtoFormat added in v0.13.0

func (e *GRPCError) ProtoFormat(opt *ProtoFormatOption) string

func (*GRPCError) ReferenceNames added in v0.13.0

func (e *GRPCError) ReferenceNames() []string

ReferenceNames returns all the unique reference names in the error definition.

type GRPCErrorDetail added in v0.13.0

type GRPCErrorDetail struct {
	If                   *CELValue
	DefSet               *VariableDefinitionSet
	Messages             *VariableDefinitionSet
	PreconditionFailures []*PreconditionFailure
	BadRequests          []*BadRequest
	LocalizedMessages    []*LocalizedMessage
}

func (*GRPCErrorDetail) MarkUsed added in v0.13.0

func (detail *GRPCErrorDetail) MarkUsed(nameRefMap map[string]struct{})

func (*GRPCErrorDetail) MessageExprs added in v0.13.0

func (detail *GRPCErrorDetail) MessageExprs() []*MessageExpr

func (*GRPCErrorDetail) MessageToDefsMap added in v0.13.0

func (detail *GRPCErrorDetail) MessageToDefsMap() map[*Message]VariableDefinitions

func (*GRPCErrorDetail) ProtoFormat added in v0.13.0

func (detail *GRPCErrorDetail) ProtoFormat(opt *ProtoFormatOption) string

func (*GRPCErrorDetail) ReferenceNames added in v0.13.0

func (detail *GRPCErrorDetail) ReferenceNames() []string

type GRPCErrorDetails added in v0.13.0

type GRPCErrorDetails []*GRPCErrorDetail

func (GRPCErrorDetails) ProtoFormat added in v0.13.0

func (d GRPCErrorDetails) ProtoFormat(opt *ProtoFormatOption) string

type GRPCErrorIndexes added in v0.13.0

type GRPCErrorIndexes struct {
	DefIdx       int
	ErrDetailIdx int
}

type GoPackage

type GoPackage struct {
	Name       string
	ImportPath string
	AliasName  string
}

func ResolveGoPackage

func ResolveGoPackage(def *descriptorpb.FileDescriptorProto) (*GoPackage, error)

type Iterator added in v0.6.0

type Iterator struct {
	Name   string
	Source *VariableDefinition
}

func (*Iterator) ProtoFormat added in v0.7.1

func (iter *Iterator) ProtoFormat(opt *ProtoFormatOption) string

type LocalizedMessage added in v0.5.2

type LocalizedMessage struct {
	Locale  string
	Message *CELValue
}

type LocationError

type LocationError struct {
	Location *source.Location
	Message  string
}

LocationError holds error message with location.

func ErrWithLocation

func ErrWithLocation(msg string, loc *source.Location) *LocationError

ErrWithLocation creates LocationError instance from message and location.

func ToLocationError

func ToLocationError(err error) *LocationError

ToLocationError convert err into LocationError if error instances the one.

func (*LocationError) Error

func (e *LocationError) Error() string

type MapExpr added in v0.6.0

type MapExpr struct {
	Iterator *Iterator
	Expr     *MapIteratorExpr
}

func (*MapExpr) MarkUsed added in v0.13.0

func (e *MapExpr) MarkUsed(_ map[string]struct{})

func (*MapExpr) MessageExprs added in v0.13.0

func (e *MapExpr) MessageExprs() []*MessageExpr

func (*MapExpr) ProtoFormat added in v0.7.1

func (e *MapExpr) ProtoFormat(opt *ProtoFormatOption) string

func (*MapExpr) ReferenceNames added in v0.6.0

func (e *MapExpr) ReferenceNames() []string

type MapIteratorExpr added in v0.6.0

type MapIteratorExpr struct {
	Type    *Type
	By      *CELValue
	Message *MessageExpr
}

func (*MapIteratorExpr) ProtoFormat added in v0.7.1

func (e *MapIteratorExpr) ProtoFormat(opt *ProtoFormatOption) []string

func (*MapIteratorExpr) ReferenceNames added in v0.6.0

func (e *MapIteratorExpr) ReferenceNames() []string

func (*MapIteratorExpr) ToVariableExpr added in v0.7.1

func (e *MapIteratorExpr) ToVariableExpr() *VariableExpr

type Message

type Message struct {
	File           *File
	Name           string
	IsMapEntry     bool
	ParentMessage  *Message
	NestedMessages []*Message
	Enums          []*Enum
	Fields         []*Field
	Oneofs         []*Oneof
	Rule           *MessageRule
}

func NewMessage

func NewMessage(name string, fields []*Field) *Message

func (*Message) AllEnums added in v0.13.1

func (m *Message) AllEnums() []*Enum

func (*Message) AllMessages added in v0.13.5

func (m *Message) AllMessages() []*Message

func (*Message) CustomResolverFields

func (m *Message) CustomResolverFields() []*Field

func (*Message) CustomResolvers added in v0.5.2

func (m *Message) CustomResolvers() []*CustomResolver

func (*Message) DependServices added in v0.5.2

func (m *Message) DependServices() []*Service

func (*Message) DependencyGraphTreeFormat

func (m *Message) DependencyGraphTreeFormat() string

func (*Message) FQDN

func (m *Message) FQDN() string

func (*Message) Field

func (m *Message) Field(name string) *Field

func (*Message) FileName

func (m *Message) FileName() string

func (*Message) GoPackage

func (m *Message) GoPackage() *GoPackage

func (*Message) GoPackageDependencies added in v0.5.2

func (m *Message) GoPackageDependencies() []*GoPackage

func (*Message) HasCELValue added in v0.2.0

func (m *Message) HasCELValue() bool

func (*Message) HasCustomResolver

func (m *Message) HasCustomResolver() bool

func (*Message) HasCustomResolverFields

func (m *Message) HasCustomResolverFields() bool

func (*Message) HasField

func (m *Message) HasField(name string) bool

func (*Message) HasFieldRule

func (m *Message) HasFieldRule() bool

func (*Message) HasResolvers added in v0.4.0

func (m *Message) HasResolvers() bool

func (*Message) HasRule

func (m *Message) HasRule() bool

func (*Message) HasRuleEveryFields

func (m *Message) HasRuleEveryFields() bool

func (*Message) Oneof added in v0.3.0

func (m *Message) Oneof(name string) *Oneof

func (*Message) Package

func (m *Message) Package() *Package

func (*Message) PackageName

func (m *Message) PackageName() string

func (*Message) ParentMessageNames

func (m *Message) ParentMessageNames() []string

func (*Message) ReferenceNames added in v0.2.0

func (m *Message) ReferenceNames() []string

func (*Message) TypeConversionDecls

func (m *Message) TypeConversionDecls() []*TypeConversionDecl

func (*Message) UseAllNameReference

func (m *Message) UseAllNameReference()

func (*Message) VariableDefinitionGroups added in v0.10.0

func (m *Message) VariableDefinitionGroups() []VariableDefinitionGroup

type MessageDependencyGraph

type MessageDependencyGraph struct {
	Roots []*MessageDependencyGraphNode
}

func (*MessageDependencyGraph) VariableDefinitionGroups added in v0.10.0

func (g *MessageDependencyGraph) VariableDefinitionGroups() []VariableDefinitionGroup

type MessageDependencyGraphNode

type MessageDependencyGraphNode struct {
	Parent             []*MessageDependencyGraphNode
	Children           []*MessageDependencyGraphNode
	ParentMap          map[*MessageDependencyGraphNode]struct{}
	ChildrenMap        map[*MessageDependencyGraphNode]struct{}
	BaseMessage        *Message
	VariableDefinition *VariableDefinition
}

func (*MessageDependencyGraphNode) FQDN added in v0.3.0

type MessageExpr added in v0.6.0

type MessageExpr struct {
	Message *Message
	Args    []*Argument
}

func (*MessageExpr) ProtoFormat added in v0.6.0

func (e *MessageExpr) ProtoFormat(opt *ProtoFormatOption) string

func (*MessageExpr) ReferenceNames added in v0.6.0

func (e *MessageExpr) ReferenceNames() []string

type MessageRule

type MessageRule struct {
	MessageArgument *Message
	CustomResolver  bool
	Alias           *Message
	DefSet          *VariableDefinitionSet
}

func (*MessageRule) ProtoFormat

func (r *MessageRule) ProtoFormat(opt *ProtoFormatOption) string

type Method

type Method struct {
	Service  *Service
	Name     string
	Request  *Message
	Response *Message
	Rule     *MethodRule
}

func (*Method) FQDN

func (m *Method) FQDN() string

func (*Method) ProtoFormat

func (m *Method) ProtoFormat(opt *ProtoFormatOption) string

type MethodCall

type MethodCall struct {
	Method  *Method
	Request *Request
	Timeout *time.Duration
	Retry   *RetryPolicy
}

type MethodRule

type MethodRule struct {
	Timeout *time.Duration
}

type Oneof

type Oneof struct {
	Name    string
	Message *Message
	Fields  []*Field
}

func (*Oneof) IsSameType added in v0.3.0

func (oneof *Oneof) IsSameType() bool

type OneofField

type OneofField struct {
	*Field
}

func (*OneofField) FQDN

func (f *OneofField) FQDN() string

func (*OneofField) IsConflict

func (f *OneofField) IsConflict() bool

type OutputFilePathConfig

type OutputFilePathConfig struct {
	// Mode for file output ( default: ImportMode ).
	Mode OutputFilePathMode
	// Prefix used in ModulePrefixMode.
	Prefix string
	// FilePath specify if you know the file path specified at compile time.
	FilePath string
	// ImportPaths list of import paths used during compile.
	ImportPaths []string
}

type OutputFilePathMode

type OutputFilePathMode int
const (
	ImportMode         OutputFilePathMode = 0
	ModulePrefixMode   OutputFilePathMode = 1
	SourceRelativeMode OutputFilePathMode = 2
)

type OutputFilePathResolver

type OutputFilePathResolver struct {
	// contains filtered or unexported fields
}

func NewOutputFilePathResolver

func NewOutputFilePathResolver(cfg OutputFilePathConfig) *OutputFilePathResolver

func (*OutputFilePathResolver) FileName

func (r *OutputFilePathResolver) FileName(file *File) string

func (*OutputFilePathResolver) OutputDir

func (r *OutputFilePathResolver) OutputDir(fileName string, gopkg *GoPackage) (string, error)

func (*OutputFilePathResolver) OutputPath

func (r *OutputFilePathResolver) OutputPath(file *File) (string, error)

OutputPath returns the path to the output file. Three output mode supported by protoc-gen-go are available. FYI: https://protobuf.dev/reference/go/go-generated.

type Package

type Package struct {
	Name  string
	Files Files
}

type PreconditionFailure added in v0.5.2

type PreconditionFailure struct {
	Violations []*PreconditionFailureViolation
}

type PreconditionFailureViolation added in v0.5.2

type PreconditionFailureViolation struct {
	Type        *CELValue
	Subject     *CELValue
	Description *CELValue
}

type ProtoFormatOption

type ProtoFormatOption struct {
	IndentLevel    int
	Prefix         string
	IndentSpaceNum int
}

type Request

type Request struct {
	Args []*Argument
	Type *Message
}

func (*Request) ProtoFormat

func (r *Request) ProtoFormat(opt *ProtoFormatOption) string

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

func New

func (*Resolver) Candidates

func (r *Resolver) Candidates(loc *source.Location) []string

func (*Resolver) Resolve

func (r *Resolver) Resolve() (*Result, error)

func (*Resolver) ResolveWellknownFiles

func (r *Resolver) ResolveWellknownFiles() (Files, error)

type Result

type Result struct {
	// Files list of files with services with the grpc.federation.service option.
	Files []*File
	// Enums list of all enum definition.
	Enums []*Enum
	// Warnings all warnings occurred during the resolve process.
	Warnings []*Warning
}

Result of resolver processing.

type RetryPolicy

type RetryPolicy struct {
	If          *CELValue
	Constant    *RetryPolicyConstant
	Exponential *RetryPolicyExponential
}

func (*RetryPolicy) MaxRetries

func (p *RetryPolicy) MaxRetries() uint64

type RetryPolicyConstant

type RetryPolicyConstant struct {
	Interval   time.Duration
	MaxRetries uint64
}

type RetryPolicyExponential

type RetryPolicyExponential struct {
	InitialInterval     time.Duration
	RandomizationFactor float64
	Multiplier          float64
	MaxInterval         time.Duration
	MaxRetries          uint64
	MaxElapsedTime      time.Duration
}

type SequentialVariableDefinitionGroup added in v0.10.0

type SequentialVariableDefinitionGroup struct {
	Start VariableDefinitionGroup
	End   *VariableDefinition
}

func (*SequentialVariableDefinitionGroup) Type added in v0.10.0

func (*SequentialVariableDefinitionGroup) VariableDefinitions added in v0.10.0

func (g *SequentialVariableDefinitionGroup) VariableDefinitions() VariableDefinitions

type Service

type Service struct {
	File        *File
	Name        string
	Methods     []*Method
	Rule        *ServiceRule
	Messages    []*Message
	MessageArgs []*Message
	CELPlugins  []*CELPlugin
}

func (*Service) CustomResolvers

func (s *Service) CustomResolvers() []*CustomResolver

func (*Service) ExistsCustomResolver

func (s *Service) ExistsCustomResolver() bool

func (*Service) FQDN

func (s *Service) FQDN() string

func (*Service) GoPackage

func (s *Service) GoPackage() *GoPackage

func (*Service) GoPackageDependencies

func (s *Service) GoPackageDependencies() []*GoPackage

func (*Service) HasMessageInMethod added in v0.4.0

func (s *Service) HasMessageInMethod(msg *Message) bool

func (*Service) Method

func (s *Service) Method(name string) *Method

func (*Service) Package

func (s *Service) Package() *Package

func (*Service) PackageName

func (s *Service) PackageName() string

func (*Service) ServiceDependencies

func (s *Service) ServiceDependencies() []*ServiceDependency

func (*Service) UseServices

func (s *Service) UseServices() []*Service

type ServiceDependency

type ServiceDependency struct {
	Name    string
	Service *Service
}

type ServiceRule

type ServiceRule struct {
}

type Type

type Type struct {
	Kind       types.Kind
	Repeated   bool
	Message    *Message
	Enum       *Enum
	OneofField *OneofField
}
var (
	AnyType       *Type
	TimestampType *Type
	DurationType  *Type
	EmptyType     *Type
)

func NewCELStandardLibraryMessageType added in v0.9.2

func NewCELStandardLibraryMessageType(pkgName, msgName string) *Type

func NewMessageType

func NewMessageType(msg *Message, repeated bool) *Type

func (*Type) Clone

func (t *Type) Clone() *Type

func (*Type) FQDN

func (t *Type) FQDN() string

func (*Type) IsNumber

func (t *Type) IsNumber() bool

type TypeConversionDecl

type TypeConversionDecl struct {
	From *Type
	To   *Type
}

func (*TypeConversionDecl) FQDN

func (decl *TypeConversionDecl) FQDN() string

type ValidationExpr added in v0.6.0

type ValidationExpr struct {
	Name  string
	Error *GRPCError
}

func (*ValidationExpr) MarkUsed added in v0.13.0

func (e *ValidationExpr) MarkUsed(nameRefMap map[string]struct{})

func (*ValidationExpr) MessageExprs added in v0.13.0

func (e *ValidationExpr) MessageExprs() []*MessageExpr

func (*ValidationExpr) MessageToDefsMap added in v0.13.0

func (e *ValidationExpr) MessageToDefsMap() map[*Message]VariableDefinitions

func (*ValidationExpr) ProtoFormat added in v0.6.0

func (e *ValidationExpr) ProtoFormat(opt *ProtoFormatOption) string

type Value

type Value struct {
	Inline bool
	CEL    *CELValue
	Const  *ConstValue
}

func NewBoolValue

func NewBoolValue(v bool) *Value

func NewBoolsValue

func NewBoolsValue(v ...bool) *Value

func NewByValue added in v0.7.1

func NewByValue(expr string, out *Type) *Value

func NewByteStringValue

func NewByteStringValue(v []byte) *Value

func NewByteStringsValue

func NewByteStringsValue(v ...[]byte) *Value

func NewDoubleValue

func NewDoubleValue(v float64) *Value

func NewDoublesValue

func NewDoublesValue(v ...float64) *Value

func NewEnumValue

func NewEnumValue(v *EnumValue) *Value

func NewEnumsValue

func NewEnumsValue(v ...*EnumValue) *Value

func NewEnvValue

func NewEnvValue(v EnvKey) *Value

func NewEnvsValue

func NewEnvsValue(v ...EnvKey) *Value

func NewFixed32Value

func NewFixed32Value(v uint32) *Value

func NewFixed32sValue

func NewFixed32sValue(v ...uint32) *Value

func NewFixed64Value

func NewFixed64Value(v uint64) *Value

func NewFixed64sValue

func NewFixed64sValue(v ...uint64) *Value

func NewFloatValue

func NewFloatValue(v float32) *Value

func NewFloatsValue

func NewFloatsValue(v ...float32) *Value

func NewInt32Value

func NewInt32Value(v int32) *Value

func NewInt32sValue

func NewInt32sValue(v ...int32) *Value

func NewInt64Value

func NewInt64Value(v int64) *Value

func NewInt64sValue

func NewInt64sValue(v ...int64) *Value

func NewMessageValue

func NewMessageValue(typ *Type, v map[string]*Value) *Value

func NewMessagesValue

func NewMessagesValue(typ *Type, v ...map[string]*Value) *Value

func NewSfixed32Value

func NewSfixed32Value(v int32) *Value

func NewSfixed32sValue

func NewSfixed32sValue(v ...int32) *Value

func NewSfixed64Value

func NewSfixed64Value(v int64) *Value

func NewSfixed64sValue

func NewSfixed64sValue(v ...int64) *Value

func NewSint32Value

func NewSint32Value(v int32) *Value

func NewSint32sValue

func NewSint32sValue(v ...int32) *Value

func NewSint64Value

func NewSint64Value(v int64) *Value

func NewSint64sValue

func NewSint64sValue(v ...int64) *Value

func NewStringValue

func NewStringValue(v string) *Value

func NewStringsValue

func NewStringsValue(v ...string) *Value

func NewUint32Value

func NewUint32Value(v uint32) *Value

func NewUint32sValue

func NewUint32sValue(v ...uint32) *Value

func NewUint64Value

func NewUint64Value(v uint64) *Value

func NewUint64sValue

func NewUint64sValue(v ...uint64) *Value

func (*Value) ProtoFormat

func (v *Value) ProtoFormat(opt *ProtoFormatOption) string

func (*Value) ReferenceNames added in v0.2.0

func (v *Value) ReferenceNames() []string

func (*Value) Type added in v0.2.0

func (v *Value) Type() *Type

type ValueCandidate added in v0.7.0

type ValueCandidate struct {
	Name string
	Type *Type
}

type ValueCandidates added in v0.7.0

type ValueCandidates []*ValueCandidate

func (ValueCandidates) Filter added in v0.7.0

func (c ValueCandidates) Filter(typ *Type) ValueCandidates

func (ValueCandidates) Names added in v0.7.0

func (c ValueCandidates) Names() []string

func (ValueCandidates) Unique added in v0.7.0

func (c ValueCandidates) Unique() ValueCandidates

type VariableDefinition added in v0.6.0

type VariableDefinition struct {
	Idx      int
	Name     string
	If       *CELValue
	AutoBind bool
	Used     bool
	Expr     *VariableExpr
	// contains filtered or unexported fields
}

func (*VariableDefinition) MarkUsed added in v0.13.0

func (def *VariableDefinition) MarkUsed(nameRefMap map[string]struct{})

func (*VariableDefinition) MessageExprs added in v0.7.1

func (def *VariableDefinition) MessageExprs() []*MessageExpr

func (*VariableDefinition) MessageToDefsMap added in v0.13.0

func (def *VariableDefinition) MessageToDefsMap() map[*Message]VariableDefinitions

func (*VariableDefinition) ProtoFormat added in v0.6.0

func (def *VariableDefinition) ProtoFormat(opt *ProtoFormatOption) string

func (*VariableDefinition) ReferenceNames added in v0.6.0

func (def *VariableDefinition) ReferenceNames() []string

type VariableDefinitionGroup added in v0.10.0

type VariableDefinitionGroup interface {
	Type() VariableDefinitionGroupType
	VariableDefinitions() VariableDefinitions
	// contains filtered or unexported methods
}

type VariableDefinitionGroupType added in v0.10.0

type VariableDefinitionGroupType string
const (
	SequentialVariableDefinitionGroupType VariableDefinitionGroupType = "sequential"
	ConcurrentVariableDefinitionGroupType VariableDefinitionGroupType = "concurrent"
)

type VariableDefinitionSet added in v0.13.0

type VariableDefinitionSet struct {
	Defs   VariableDefinitions
	Groups []VariableDefinitionGroup
	Graph  *MessageDependencyGraph
}

func (*VariableDefinitionSet) DefinitionGroups added in v0.13.0

func (set *VariableDefinitionSet) DefinitionGroups() []VariableDefinitionGroup

func (*VariableDefinitionSet) Definitions added in v0.13.0

func (set *VariableDefinitionSet) Definitions() VariableDefinitions

func (*VariableDefinitionSet) DependencyGraph added in v0.13.0

func (set *VariableDefinitionSet) DependencyGraph() *MessageDependencyGraph

func (*VariableDefinitionSet) MarkUsed added in v0.13.0

func (set *VariableDefinitionSet) MarkUsed(nameRefMap map[string]struct{})

func (*VariableDefinitionSet) MessageExprs added in v0.13.0

func (set *VariableDefinitionSet) MessageExprs() []*MessageExpr

func (*VariableDefinitionSet) MessageToDefsMap added in v0.13.0

func (set *VariableDefinitionSet) MessageToDefsMap() map[*Message]VariableDefinitions

func (*VariableDefinitionSet) ReferenceNames added in v0.13.0

func (set *VariableDefinitionSet) ReferenceNames() []string

type VariableDefinitions added in v0.6.0

type VariableDefinitions []*VariableDefinition

func (VariableDefinitions) ProtoFormat added in v0.6.0

func (defs VariableDefinitions) ProtoFormat(opt *ProtoFormatOption) string

type VariableExpr added in v0.6.0

type VariableExpr struct {
	Type       *Type
	By         *CELValue
	Map        *MapExpr
	Call       *CallExpr
	Message    *MessageExpr
	Validation *ValidationExpr
}

func (*VariableExpr) ProtoFormat added in v0.6.0

func (e *VariableExpr) ProtoFormat(opt *ProtoFormatOption) string

func (*VariableExpr) ReferenceNames added in v0.7.2

func (e *VariableExpr) ReferenceNames() []string

type Warning

type Warning struct {
	Location *source.Location
	Message  string
}

Warning represents what should be warned that is not an error that occurred during the Resolver.Resolve().

Jump to

Keyboard shortcuts

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