schema

package
v0.0.76 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIFetcher

type APIFetcher struct {
	URL    string
	APIKey string
}

func NewAPIFetcher

func NewAPIFetcher(url, apiKey string) *APIFetcher

NewAPIFetcher creates a new API fetcher using the provided URL and API key.

func (*APIFetcher) FetchTable

func (f *APIFetcher) FetchTable(ctx context.Context, table string) (io.ReadCloser, error)

type Cache

type Cache struct {
	TTL int `json:"ttl"`
}

type Changefeed

type Changefeed struct {
	AppendFieldsToSubject []string `json:"appendFieldsToSubject"`
	PartitionKeys         []string `json:"partitionKeys"`
}

type Fetcher

type Fetcher interface {
	FetchTable(ctx context.Context, table string) (io.ReadCloser, error)
}

type Model

type Model struct {
	Cache        *Cache      `json:"cache"`
	Changefeed   *Changefeed `json:"changefeed"`
	ModelVersion string      `json:"modelVersion"`
	Public       bool        `json:"public"`
}

type ModelRegistry

type ModelRegistry interface {
	Get(ctx context.Context, table string) (*Model, error)
}

func NewModelRegistry

func NewModelRegistry(fetcher Fetcher, opts ...WithOption) ModelRegistry

NewModelRegistry creates a new model registry using the provided fetcher.

type ModelRegistryOption

type ModelRegistryOption struct {
	ExpireAfter time.Duration
}

type Result

type Result struct {
	Success bool   `json:"success"`
	Model   *Model `json:"data"`
}

type WithOption

type WithOption func(opt *ModelRegistryOption)

func WithExpireAfter

func WithExpireAfter(expireAfter time.Duration) WithOption

WithExpireAfter sets the expire after duration for an item in the model registry.

Jump to

Keyboard shortcuts

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