Documentation ¶
Index ¶
- Variables
- func Compare(current, prev []byte, rulesToSkip []string) error
- func NewRule(id, description string, check CheckFunc) *rule
- type CheckFunc
- type ProtobufDBFile
- type Repository
- type Rule
- type SearchData
- type Service
- func (s *Service) Get(ctx context.Context, snapshot *snapshot.Snapshot, names []string) (data []byte, err error)
- func (s *Service) Insert(ctx context.Context, snapshot *snapshot.Snapshot, data []byte) error
- func (s *Service) Validate(ctx context.Context, cs *snapshot.Snapshot, data []byte, rulesToSkip []string) error
- type Snapshot
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCast = errors.New("not able to convert to desired type")
View Source
var ErrNotFound = errors.New("not found")
View Source
var ( Rules = []Rule{ NewRule( "FILE_NO_BREAKING_CHANGE", "Ensures file does not have breaking changes from previous version, eg: No change in syntax, package name or removal of file", checkFileNoBreakingChange, ), NewRule( "MESSAGE_NO_DELETE", "Ensures no message is deleted from previous version", checkMessageNoDelete, ), NewRule( "FIELD_NO_BREAKING_CHANGE", "Ensures field does not have breaking changes from previous version, eg: No change in type, number, json name, label, field name or removal of field", checkFieldNoBreakingChange, ), NewRule( "ENUM_NO_BREAKING_CHANGE", "Ensures enum does not have breaking changes from previous version, eg: No change in name and number or removal of enum", checkEnumNoBreakingChange, ), } )
Functions ¶
Types ¶
type CheckFunc ¶
type CheckFunc func(current, prev *protoregistry.Files) error
CheckFunc rule entry point
type ProtobufDBFile ¶
type ProtobufDBFile struct { ID int64 SearchData *SearchData Data []byte }
ProtobufDBFile structure to store for each file info in DB
func ToProtobufDBFile ¶
func ToProtobufDBFile(file protoreflect.FileDescriptor) *ProtobufDBFile
ToProtobufDBFile converts protoreflect.FileDescriptor type ProtobufDBFile
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository DB access layer
func NewProtoRepository ¶
func NewProtoRepository(db *store.DB) *Repository
NewProtoRepository create instance repo
func (*Repository) Get ¶
func (r *Repository) Get(ctx context.Context, snapshot *snapshot.Snapshot, names []string) ([][]byte, error)
Get Fullycontained descriptorset file given list of fully qualified message names. If message names are empty then whole fileDescriptorSet data returned
func (*Repository) Put ¶
func (r *Repository) Put(ctx context.Context, snapshot *snapshot.Snapshot, dbFiles []*ProtobufDBFile) error
Put inserts fileDescriptorset information in DB
type Rule ¶
type Rule interface { ID() string Check(*protoregistry.Files, *protoregistry.Files) error }
Rule interface
type SearchData ¶
type SearchData struct { Path string `json:"path"` Messages []string `json:"messages"` Dependencies []string `json:"dependencies"` }
SearchData contains searchable field information
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles proto CRUD operations
func NewService ¶
func NewService(r *Repository, sr *snapshot.Repository) *Service
NewService creates new instance of proto service
func (*Service) Get ¶
func (s *Service) Get(ctx context.Context, snapshot *snapshot.Snapshot, names []string) (data []byte, err error)
Get returns proto schema details from DB
Click to show internal directories.
Click to hide internal directories.