kvs

package
v0.12.5 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 4 Imported by: 3

README

Document

Sogo github.com/sogo/database/kvs provides a storage abstraction layer for various storage engines with a common configuration struct and getter/setter interfaces.

Initially, it's goal is to provide services for simple key value string storage. This use case is very simple but often times you may want to use a different solution depending on your provider, e.g. DynamoDB for AWS, Redis for Heroku, and the local file system for testing.

Supported engines include:

  • DynamoDB
  • Files
  • Redis

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	SetString(ctx context.Context, key, val string) error
	GetString(ctx context.Context, key string) (string, error)
	GetOrDefaultString(ctx context.Context, key, def string) string
	SetAny(ctx context.Context, key string, val any) error
	GetAny(ctx context.Context, key string, val any) error
}

type Config

type Config struct {
	Host               string `json:"host,omitempty"`
	Port               int    `json:"port,omitempty"`
	Password           string `json:"password,omitempty"`
	CustomIndex        int    `json:"customIndex,omitempty"` // Redis Database Index
	Region             string `json:"region,omitempty"`      // DynamoDB
	Table              string `json:"table,omitempty"`       // DynamoDB
	Directory          string `json:"directory,omitempty"`
	FileMode           uint32 `json:"fileMode,omitempty"`
	DynamodbReadUnits  int64  `json:"dynamodbReadUnits,omitempty"`
	DynamodbWriteUnits int64  `json:"dynamodbWriteUnits,omitempty"`
}

func ParseConfig

func ParseConfig(jsonBytes []byte) (*Config, error)

func (*Config) HostPort

func (cfg *Config) HostPort() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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