Documentation ¶
Index ¶
- Variables
- type BaseClient
- func (c *BaseClient) CreateSchema(ctx context.Context, schema *Schema) (*Schema, error)
- func (c *BaseClient) DeleteSchemaByVersion(ctx context.Context, subject string, version int, permanent bool) (int, error)
- func (c *BaseClient) DeleteSubject(ctx context.Context, subject string, permanent bool) ([]int, error)
- func (c *BaseClient) GetLatestSchema(ctx context.Context, subject string) (*Schema, error)
- func (c *BaseClient) GetSchemaByID(ctx context.Context, schemaID int) (*Schema, error)
- func (c *BaseClient) GetSchemaByVersion(ctx context.Context, subject string, version int) (*Schema, error)
- func (c *BaseClient) GetSchemaSubjectVersions(ctx context.Context, schemaID int) (map[string]int, error)
- func (c *BaseClient) GetSubjectVersions(ctx context.Context, subject string) ([]int, error)
- func (c *BaseClient) GetSubjects(ctx context.Context) ([]string, error)
- func (c *BaseClient) IsSchemaCompatible(ctx context.Context, schema *Schema) (bool, error)
- type BaseClientOption
- type CachingClient
- func (c *CachingClient) CreateSchema(ctx context.Context, schema *Schema) (createdSchema *Schema, err error)
- func (c *CachingClient) DeleteSchemaByVersion(ctx context.Context, subject string, version int, permanent bool) (int, error)
- func (c *CachingClient) DeleteSubject(ctx context.Context, subject string, permanent bool) ([]int, error)
- func (c *CachingClient) GetLatestSchema(ctx context.Context, subject string) (schema *Schema, err error)
- func (c *CachingClient) GetSchemaByID(ctx context.Context, schemaID int) (schema *Schema, err error)
- func (c *CachingClient) GetSchemaByVersion(ctx context.Context, subject string, version int) (schema *Schema, err error)
- func (c *CachingClient) GetSchemaSubjectVersions(ctx context.Context, schemaID int) (map[string]int, error)
- func (c *CachingClient) GetSubjectVersions(ctx context.Context, subject string) (versions []int, err error)
- func (c *CachingClient) GetSubjects(ctx context.Context) (subjects []string, err error)
- func (c *CachingClient) IsSchemaCompatible(ctx context.Context, schema *Schema) (bool, error)
- type CachingClientOption
- type Client
- type GlobalOption
- type Option
- type Reference
- type Schema
- type SchemaType
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("404 not found")
Functions ¶
This section is empty.
Types ¶
type BaseClient ¶
type BaseClient struct {
// contains filtered or unexported fields
}
BaseClient defines schema registry http client
func NewBaseClient ¶
func NewBaseClient(opts ...BaseClientOption) *BaseClient
NewBaseClient creates new HTTP client
func (*BaseClient) CreateSchema ¶
func (*BaseClient) DeleteSchemaByVersion ¶
func (*BaseClient) DeleteSubject ¶
func (*BaseClient) GetLatestSchema ¶
func (*BaseClient) GetSchemaByID ¶
func (*BaseClient) GetSchemaByVersion ¶
func (*BaseClient) GetSchemaSubjectVersions ¶
func (*BaseClient) GetSubjectVersions ¶
func (*BaseClient) GetSubjects ¶
func (c *BaseClient) GetSubjects(ctx context.Context) ([]string, error)
GetSubjects method gets list of defined subjects
func (*BaseClient) IsSchemaCompatible ¶
type BaseClientOption ¶
type BaseClientOption func(*BaseClient)
func WithCredentials ¶
func WithCredentials(username string, password string) BaseClientOption
WithCredentials option sets credentials for client
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) BaseClientOption
WithHTTPClient option sets http client to use for requests
func WithInsecure ¶
func WithInsecure(insecure ...bool) BaseClientOption
WithInsecure overrides default transport and sets insecure skip verify
func (BaseClientOption) OptionType ¶
func (BaseClientOption) OptionType()
type CachingClient ¶
type CachingClient struct {
// contains filtered or unexported fields
}
CachingClient implements schema registry Client with caching capabilities
func NewCachingClient ¶
func NewCachingClient(client Client, opts ...CachingClientOption) *CachingClient
NewCachingClient creates a new client with caching support
func (*CachingClient) CreateSchema ¶
func (*CachingClient) DeleteSchemaByVersion ¶
func (*CachingClient) DeleteSubject ¶
func (*CachingClient) GetLatestSchema ¶
func (*CachingClient) GetSchemaByID ¶
func (*CachingClient) GetSchemaByVersion ¶
func (*CachingClient) GetSchemaSubjectVersions ¶
func (*CachingClient) GetSubjectVersions ¶
func (*CachingClient) GetSubjects ¶
func (c *CachingClient) GetSubjects(ctx context.Context) (subjects []string, err error)
GetSubjects gets a list of defines subjects
func (*CachingClient) IsSchemaCompatible ¶
type CachingClientOption ¶
type CachingClientOption func(*CachingClient)
func WithExpiration ¶
func WithExpiration(time time.Duration) CachingClientOption
WithExpiration set expiration for mutable entries like list of subjects
func WithSchemaValueCaching ¶
func WithSchemaValueCaching(enable ...bool) CachingClientOption
WithSchemaValueCaching enables caching of schema values
func (CachingClientOption) OptionType ¶
func (CachingClientOption) OptionType()
type Client ¶
type Client interface { GetSubjects(ctx context.Context) ([]string, error) GetSubjectVersions(ctx context.Context, subject string) ([]int, error) GetSchemaByID(ctx context.Context, schemaID int) (*Schema, error) GetSchemaByVersion(ctx context.Context, subject string, version int) (*Schema, error) GetSchemaSubjectVersions(ctx context.Context, schemaID int) (map[string]int, error) GetLatestSchema(ctx context.Context, subject string) (*Schema, error) CreateSchema(ctx context.Context, schema *Schema) (*Schema, error) DeleteSubject(ctx context.Context, subject string, permanent bool) ([]int, error) DeleteSchemaByVersion(ctx context.Context, subject string, version int, permanent bool) (int, error) IsSchemaCompatible(ctx context.Context, schema *Schema) (bool, error) }
Client defines interface for schema registry client, that is implemented by HTTPClient and CachingClient
type GlobalOption ¶
type GlobalOption func(o *globalOptions)
func (GlobalOption) OptionType ¶
func (GlobalOption) OptionType()
type Option ¶
type Option interface{ OptionType() }
Option interface is here, so we can type check if valid arg is parsed as Option to client
type Reference ¶
type Reference struct { Name string `json:"name"` Subject string `json:"subject"` Version int `json:"version"` }
Reference defines struct for schema registry references
In case of protobuf these are imported schema files and in case of JSON schema these are schemas referenced using $ref
type Schema ¶
type Schema struct { ID int `json:"id,omitempty"` Schema string `json:"schema,omitempty"` Subject string `json:"subject,omitempty"` Version int `json:"version,omitempty"` References []Reference `json:"references,omitempty"` Type SchemaType `json:"schemaType,omitempty"` }
Schema is a data structure that holds all the relevant information about schemas.
func (*Schema) GetRawSchema ¶
type SchemaType ¶
type SchemaType string
SchemaType defines type of schema
const ( // ProtobufSchemaType schema type ProtobufSchemaType SchemaType = "PROTOBUF" // AvroSchemaType schema type AvroSchemaType SchemaType = "AVRO" // JSONSchemaType scema type JSONSchemaType SchemaType = "JSON" )
func (SchemaType) String ¶
func (s SchemaType) String() string