kvstore

package
v0.0.0-test Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Wildcard to query all organizations
	AllOrganizations = -1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Id        int64
	OrgId     *int64
	Namespace *string
	Key       *string
	Value     string

	Created time.Time
	Updated time.Time
}

Item stored in k/v store.

func (*Item) TableName

func (i *Item) TableName() string

type KVStore

type KVStore interface {
	Get(ctx context.Context, orgId int64, namespace string, key string) (string, bool, error)
	Set(ctx context.Context, orgId int64, namespace string, key string, value string) error
	Del(ctx context.Context, orgId int64, namespace string, key string) error
	Keys(ctx context.Context, orgId int64, namespace string, keyPrefix string) ([]Key, error)
}

KVStore is an interface for k/v store.

func ProvideService

func ProvideService(sqlStore *sqlstore.SQLStore) KVStore

type Key

type Key struct {
	OrgId     int64
	Namespace string
	Key       string
}

func (*Key) TableName

func (i *Key) TableName() string

type NamespacedKVStore

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

NamespacedKVStore is a KVStore wrapper with fixed orgId and namespace.

func WithNamespace

func WithNamespace(kv KVStore, orgId int64, namespace string) *NamespacedKVStore

WithNamespace returns a kvstore wrapper with fixed orgId and namespace.

func (*NamespacedKVStore) Del

func (kv *NamespacedKVStore) Del(ctx context.Context, key string) error

func (*NamespacedKVStore) Get

func (kv *NamespacedKVStore) Get(ctx context.Context, key string) (string, bool, error)

func (*NamespacedKVStore) Keys

func (kv *NamespacedKVStore) Keys(ctx context.Context, keyPrefix string) ([]Key, error)

func (*NamespacedKVStore) Set

func (kv *NamespacedKVStore) Set(ctx context.Context, key string, value string) error

Jump to

Keyboard shortcuts

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