kvstore

package
v3.0.0-alpha.7 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Filename string
	AutoSave bool
}

type KeyValueStore

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

func New

func New(config *Config) *KeyValueStore

func (*KeyValueStore) Delete

func (kvs *KeyValueStore) Delete(key string) error

Delete deletes the key from the store. If AutoSave is true, the store is saved to disk.

func (*KeyValueStore) Get

func (kvs *KeyValueStore) Get(key string) any

Get returns the value for the given key. If key is empty, the entire store is returned.

func (*KeyValueStore) Name

func (kvs *KeyValueStore) Name() string

Name returns the name of the plugin.

func (*KeyValueStore) OnShutdown

func (kvs *KeyValueStore) OnShutdown() error

OnShutdown will save the store to disk if there are unsaved changes.

func (*KeyValueStore) OnStartup

func (kvs *KeyValueStore) OnStartup(ctx context.Context, options application.ServiceOptions) error

OnStartup is called when the plugin is loaded. This is where you should do any setup.

func (*KeyValueStore) Save

func (kvs *KeyValueStore) Save() error

Save saves the store to disk

func (*KeyValueStore) Set

func (kvs *KeyValueStore) Set(key string, value any) error

Set sets the value for the given key. If AutoSave is true, the store is saved to disk.

type Service

type Service struct{}

Jump to

Keyboard shortcuts

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