valueset

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterDB

func RegisterDB(name string, fn func(interface{}, map[string]string) (ValuesetDB, error))

Types

type Config

type Config struct {
	ValuesetDBs []ValuesetDB
	// contains filtered or unexported fields
}

func LoadConfig

func LoadConfig(filename string, env map[string]string) (Config, error)

should get the root of the file

func UnmarshalDatabasesConfig

func UnmarshalDatabasesConfig(configMap []map[string]interface{}, env map[string]string) (Config, error)

func (Config) ValueSetLookup

func (cfg Config) ValueSetLookup(ctx context.Context, tableId string, env map[string]string) (map[string]string, error)

type ErrMultipleValues

type ErrMultipleValues struct {
	Query   map[string]string
	TableId string
}

func (ErrMultipleValues) Error

func (e ErrMultipleValues) Error() string

type LRUCache

type LRUCache[K string, V map[string]string] struct {
	ARCCache *lru.ARCCache[K, V]
}

func NewValuesetLRUCache

func NewValuesetLRUCache[K string, V map[string]string]() (*LRUCache[K, V], error)

func (*LRUCache[K, V]) Lookup

func (cache *LRUCache[K, V]) Lookup(req ls.ValuesetLookupRequest) (ls.ValuesetLookupResponse, bool)

ValuesetCache.Lookup returns the cached ValuesetLookupResponse if exists

func (*LRUCache[K, V]) Set

func (cache *LRUCache[K, V]) Set(req ls.ValuesetLookupRequest, res ls.ValuesetLookupResponse)

ValuesetCache.Set caches a generated hash as a key, storing the request as its corresponding value

type NoCache

type NoCache struct{}

func (NoCache) Lookup

func (NoCache) Set

type ValuesetCache

type ValuesetCache interface {
	Lookup(req ls.ValuesetLookupRequest) (ls.ValuesetLookupResponse, bool)
	Set(req ls.ValuesetLookupRequest, res ls.ValuesetLookupResponse)
}

type ValuesetDB

type ValuesetDB interface {
	ValueSetLookup(context.Context, string, map[string]string) (map[string]string, error)
	GetTableIds() map[string]struct{}
	Close() error
}

func UnmarshalSingleDatabaseConfig

func UnmarshalSingleDatabaseConfig(database map[string]interface{}, env map[string]string) (ValuesetDB, error)

Jump to

Keyboard shortcuts

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