kv

package
v0.0.0-...-ba70d0f Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package kv implement key-value storage base on postgresql

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KV

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

KV is a key-value storage.

func (*KV) Count

func (k *KV) Count(ctx context.Context) (int64, error)

Count implements KeyValue.

func (*KV) Create

func (k *KV) Create(ctx context.Context, entity google.Message) (google.Message, error)

Create implements KeyValue.

func (*KV) Delete

func (k *KV) Delete(ctx context.Context, id string) error

Delete implements KeyValue.

func (*KV) Exists

func (k *KV) Exists(ctx context.Context, id string) (bool, error)

Exists implements KeyValue.

func (*KV) Get

func (k *KV) Get(ctx context.Context, id string) (google.Message, error)

Get implements KeyValue.

func (*KV) GetAll

func (k *KV) GetAll(ctx context.Context) ([]google.Message, error)

GetAll implements KeyValue.

func (*KV) Update

func (k *KV) Update(ctx context.Context, id string, entity google.Message) (google.Message, error)

Update implements KeyValue.

type KeyValue

type KeyValue interface {
	Create(ctx context.Context, entity google.Message) (google.Message, error)
	Get(ctx context.Context, id string) (google.Message, error)
	GetAll(ctx context.Context) ([]google.Message, error)
	Update(ctx context.Context, id string, entity google.Message) (google.Message, error)
	Delete(ctx context.Context, id string) error
	Exists(ctx context.Context, id string) (bool, error)
	Count(ctx context.Context) (int64, error)
}

KeyValue is an interface for key-value storage.

func New

func New(tableName string, conf *celestinal.Config) KeyValue

New creates a new KeyValue instance.

Jump to

Keyboard shortcuts

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