store

package
v1.136.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemoryStore

type InMemoryStore struct {
	// contains filtered or unexported fields
}

InMemoryStore is an in-memory store implementation.

func (*InMemoryStore) Get

func (m *InMemoryStore) Get(key string) (interface{}, error)

Get retrieves a value by key from memory.

func (*InMemoryStore) Set

func (m *InMemoryStore) Set(key string, value interface{}) error

Set stores a key-value pair in memory.

type SSMClient

type SSMClient interface {
	PutParameter(ctx context.Context, params *ssm.PutParameterInput, optFns ...func(*ssm.Options)) (*ssm.PutParameterOutput, error)
	GetParameter(ctx context.Context, params *ssm.GetParameterInput, optFns ...func(*ssm.Options)) (*ssm.GetParameterOutput, error)
}

SSMClient interface allows us to mock the AWS SSM client

type SSMStore

type SSMStore struct {
	// contains filtered or unexported fields
}

SSMStore is an implementation of the Store interface for AWS SSM Parameter Store.

func (*SSMStore) Get

func (s *SSMStore) Get(key string) (interface{}, error)

Get retrieves a value by key from AWS SSM Parameter Store.

func (*SSMStore) Set

func (s *SSMStore) Set(key string, value interface{}) error

Set stores a key-value pair in AWS SSM Parameter Store.

type SSMStoreOptions

type SSMStoreOptions struct {
	Region string `mapstructure:"region"`
}

type Store

type Store interface {
	Set(key string, value interface{}) error
	Get(key string) (interface{}, error) // Default values if it doesn't exist?
}

Store defines the common interface for all store implementations.

func NewInMemoryStore

func NewInMemoryStore(options map[string]interface{}) (Store, error)

NewInMemoryStore initializes a new MemoryStore.

func NewSSMStore

func NewSSMStore(options SSMStoreOptions) (Store, error)

NewInMemoryStore initializes a new MemoryStore.

type StoreConfig

type StoreConfig struct {
	Type    string                 `yaml:"type"`
	Options map[string]interface{} `yaml:"options"`
}

type StoreFactory

type StoreFactory func(options map[string]interface{}) (Store, error)

StoreFactory is a function type to initialize a new store.

type StoreRegistry

type StoreRegistry map[string]Store

func NewStoreRegistry

func NewStoreRegistry(config *StoresConfig) (StoreRegistry, error)

type StoresConfig

type StoresConfig = map[string]StoreConfig

Jump to

Keyboard shortcuts

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