Documentation
¶
Overview ¶
Package checkutil implements helpers for the check package.
Index ¶
- func NewEnumPairRuleHandler(f func(ctx context.Context, responseWriter check.ResponseWriter, ...) error, ...) check.RuleHandler
- func NewEnumRuleHandler(f func(context.Context, check.ResponseWriter, check.Request, ...) error, ...) check.RuleHandler
- func NewEnumValueRuleHandler(f func(context.Context, check.ResponseWriter, check.Request, ...) error, ...) check.RuleHandler
- func NewFieldPairRuleHandler(f func(ctx context.Context, responseWriter check.ResponseWriter, ...) error, ...) check.RuleHandler
- func NewFieldRuleHandler(f func(context.Context, check.ResponseWriter, check.Request, ...) error, ...) check.RuleHandler
- func NewFileImportRuleHandler(...) check.RuleHandler
- func NewFilePairRuleHandler(f func(ctx context.Context, responseWriter check.ResponseWriter, ...) error, ...) check.RuleHandler
- func NewFileRuleHandler(f func(context.Context, check.ResponseWriter, check.Request, ...) error, ...) check.RuleHandler
- func NewMessagePairRuleHandler(f func(ctx context.Context, responseWriter check.ResponseWriter, ...) error, ...) check.RuleHandler
- func NewMessageRuleHandler(f func(context.Context, check.ResponseWriter, check.Request, ...) error, ...) check.RuleHandler
- func NewMethodPairRuleHandler(f func(ctx context.Context, responseWriter check.ResponseWriter, ...) error, ...) check.RuleHandler
- func NewMethodRuleHandler(f func(context.Context, check.ResponseWriter, check.Request, ...) error, ...) check.RuleHandler
- func NewOneofRuleHandler(f func(context.Context, check.ResponseWriter, check.Request, ...) error, ...) check.RuleHandler
- func NewServicePairRuleHandler(f func(ctx context.Context, responseWriter check.ResponseWriter, ...) error, ...) check.RuleHandler
- func NewServiceRuleHandler(f func(context.Context, check.ResponseWriter, check.Request, ...) error, ...) check.RuleHandler
- type IteratorOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewEnumPairRuleHandler ¶
func NewEnumPairRuleHandler( f func( ctx context.Context, responseWriter check.ResponseWriter, request check.Request, enumDescriptor protoreflect.EnumDescriptor, againstEnumDescriptor protoreflect.EnumDescriptor, ) error, options ...IteratorOption, ) check.RuleHandler
NewEnumPairRuleHandler returns a new RuleHandler that will call f for every enum pair within the check.Request's FileDescriptors() and AgainstFileDescriptors().
The enums will be paired up by fully-qualified name. Enums that cannot be paired up are skipped.
This is typically used for breaking change Rules.
func NewEnumRuleHandler ¶
func NewEnumRuleHandler( f func(context.Context, check.ResponseWriter, check.Request, protoreflect.EnumDescriptor) error, options ...IteratorOption, ) check.RuleHandler
NewEnumRuleHandler returns a new RuleHandler that will call f for every enum within the check.Request's FileDescriptors().
This is typically used for lint Rules. Most callers will use the WithoutImports() options.
func NewEnumValueRuleHandler ¶
func NewEnumValueRuleHandler( f func(context.Context, check.ResponseWriter, check.Request, protoreflect.EnumValueDescriptor) error, options ...IteratorOption, ) check.RuleHandler
NewEnumValueRuleHandler returns a new RuleHandler that will call f for every value in every enum within the check.Request's FileDescriptors().
This is typically used for lint Rules. Most callers will use the WithoutImports() options.
func NewFieldPairRuleHandler ¶
func NewFieldPairRuleHandler( f func( ctx context.Context, responseWriter check.ResponseWriter, request check.Request, fieldDescriptor protoreflect.FieldDescriptor, againstFieldDescriptor protoreflect.FieldDescriptor, ) error, options ...IteratorOption, ) check.RuleHandler
NewFieldPairRuleHandler returns a new RuleHandler that will call f for every field pair within the check.Request's FileDescriptors() and AgainstFileDescriptors().
The fields will be paired up by the fully-qualified name of the message, and the field number. Fields that cannot be paired up are skipped.
This includes extensions.
This is typically used for breaking change Rules.
func NewFieldRuleHandler ¶
func NewFieldRuleHandler( f func(context.Context, check.ResponseWriter, check.Request, protoreflect.FieldDescriptor) error, options ...IteratorOption, ) check.RuleHandler
NewFieldRuleHandler returns a new RuleHandler that will call f for every field in every message within the check.Request's FileDescriptors().
This includes extensions.
This is typically used for lint Rules. Most callers will use the WithoutImports() options.
func NewFileImportRuleHandler ¶
func NewFileImportRuleHandler( f func(context.Context, check.ResponseWriter, check.Request, protoreflect.FileImport) error, options ...IteratorOption, ) check.RuleHandler
NewFileImportRuleHandler returns a new RuleHandler that will call f for every "import" statement within the check.Request's FileDescriptors().
Note that terms are overloaded here: descriptor.FileDescriptor.IsImport denotes whether the FileDescriptor is an import itself, while this iterates over the protoreflect.FileImports within each FileDescriptor. The option WithoutImports() is a separate concern - NewFileImportRuleHandler(f, WithoutImports()) will iterate over all the FileImports for the non-import FileDescriptors.
This is typically used for lint Rules. Most callers will use the WithoutImports() options.
func NewFilePairRuleHandler ¶
func NewFilePairRuleHandler( f func( ctx context.Context, responseWriter check.ResponseWriter, request check.Request, fileDescriptor descriptor.FileDescriptor, againstFileDescriptor descriptor.FileDescriptor, ) error, options ...IteratorOption, ) check.RuleHandler
NewFilePairRuleHandler returns a new RuleHandler that will call f for every file pair within the check.Request's FileDescriptors() and AgainstFileDescriptors().
The FileDescriptors will be paired up by name. FileDescriptors that cannot be paired up are skipped.
This is typically used for breaking change Rules.
func NewFileRuleHandler ¶
func NewFileRuleHandler( f func(context.Context, check.ResponseWriter, check.Request, descriptor.FileDescriptor) error, options ...IteratorOption, ) check.RuleHandler
NewFileRuleHandler returns a new RuleHandler that will call f for every file within the check.Request's FileDescriptors().
This is typically used for lint Rules. Most callers will use the WithoutImports() options.
func NewMessagePairRuleHandler ¶
func NewMessagePairRuleHandler( f func( ctx context.Context, responseWriter check.ResponseWriter, request check.Request, messageDescriptor protoreflect.MessageDescriptor, againstMessageDescriptor protoreflect.MessageDescriptor, ) error, options ...IteratorOption, ) check.RuleHandler
NewMessagePairRuleHandler returns a new RuleHandler that will call f for every message pair within the check.Request's FileDescriptors() and AgainstFileDescriptors().
The messages will be paired up by fully-qualified name. Messages that cannot be paired up are skipped.
This is typically used for breaking change Rules.
func NewMessageRuleHandler ¶
func NewMessageRuleHandler( f func(context.Context, check.ResponseWriter, check.Request, protoreflect.MessageDescriptor) error, options ...IteratorOption, ) check.RuleHandler
NewMessageRuleHandler returns a new RuleHandler that will call f for every message within the check.Request's FileDescriptors().
This is typically used for lint Rules. Most callers will use the WithoutImports() options.
func NewMethodPairRuleHandler ¶
func NewMethodPairRuleHandler( f func( ctx context.Context, responseWriter check.ResponseWriter, request check.Request, methodDescriptor protoreflect.MethodDescriptor, againstMethodDescriptor protoreflect.MethodDescriptor, ) error, options ...IteratorOption, ) check.RuleHandler
NewMethodPairRuleHandler returns a new RuleHandler that will call f for every method pair within the check.Request's FileDescriptors() and AgainstFileDescriptors().
The services will be paired up by fully-qualified name of the service, and name of the method. Methods that cannot be paired up are skipped.
This is typically used for breaking change Rules.
func NewMethodRuleHandler ¶
func NewMethodRuleHandler( f func(context.Context, check.ResponseWriter, check.Request, protoreflect.MethodDescriptor) error, options ...IteratorOption, ) check.RuleHandler
NewMethodRuleHandler returns a new RuleHandler that will call f for every method in every service within the check.Request's FileDescriptors().
This is typically used for lint Rules. Most callers will use the WithoutImports() options.
func NewOneofRuleHandler ¶
func NewOneofRuleHandler( f func(context.Context, check.ResponseWriter, check.Request, protoreflect.OneofDescriptor) error, options ...IteratorOption, ) check.RuleHandler
NewOneofRuleHandler returns a new RuleHandler that will call f for every oneof in every message within the check.Request's FileDescriptors().
This is typically used for lint Rules. Most callers will use the WithoutImports() options.
func NewServicePairRuleHandler ¶
func NewServicePairRuleHandler( f func( ctx context.Context, responseWriter check.ResponseWriter, request check.Request, serviceDescriptor protoreflect.ServiceDescriptor, againstServiceDescriptor protoreflect.ServiceDescriptor, ) error, options ...IteratorOption, ) check.RuleHandler
NewServicePairRuleHandler returns a new RuleHandler that will call f for every service pair within the check.Request's FileDescriptors() and AgainstFileDescriptors().
The services will be paired up by fully-qualified name. Services that cannot be paired up are skipped.
This is typically used for breaking change Rules.
func NewServiceRuleHandler ¶
func NewServiceRuleHandler( f func(context.Context, check.ResponseWriter, check.Request, protoreflect.ServiceDescriptor) error, options ...IteratorOption, ) check.RuleHandler
NewServiceRuleHandler returns a new RuleHandler that will call f for every service within the check.Request's FileDescriptors().
This is typically used for lint Rules. Most callers will use the WithoutImports() options.
Types ¶
type IteratorOption ¶
type IteratorOption func(*iteratorOptions)
IteratorOption is an option for any of the New.*RuleHandler functions in this package.
func WithoutImports ¶
func WithoutImports() IteratorOption
WithoutImports returns a new IteratorOption that will not call the provided function for any imports.
For lint RuleHandlers, this is generally an option you will want to pass. For breaking RuleHandlers, you generally want to consider imports as part of breaking changes.
The default is to call the provided function for all imports.