kv

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const PluginName = "kv"
View Source
const SQLVersion = 1

Variables

View Source
var Handler = func() *chi.Mux {

	apiMux := chi.NewMux()
	apiMux.NotFound(rest.NotFoundHandler)
	apiMux.MethodNotAllowed(rest.NotFoundHandler)

	apiMux.Mount("/api/kv/users", GenerateHandler(UserAuth))
	apiMux.Mount("/api/kv/apps", GenerateHandler(AppAuth))
	apiMux.Mount("/api/kv/objects", GenerateHandler(ObjectAuth))

	return apiMux
}()

Functions

func GenerateHandler

func GenerateHandler(authenticator func(ctx *rest.Context, id string, namespace string) (KV, error)) *chi.Mux

func SQLUpdater

func SQLUpdater(db *database.AdminDB, i *run.Info, curversion int) error

SQLUpdater is in the format expected by Heedy to update the database

Types

type AdminAppKV

type AdminAppKV struct {
	DB        *database.AdminDB
	ID        string
	Namespace string
}

func (*AdminAppKV) DelKey

func (k *AdminAppKV) DelKey(key string) error

func (*AdminAppKV) Get

func (k *AdminAppKV) Get() (map[string]interface{}, error)

func (*AdminAppKV) GetKey

func (k *AdminAppKV) GetKey(key string) (interface{}, error)

func (*AdminAppKV) Set

func (k *AdminAppKV) Set(data map[string]interface{}) error

func (*AdminAppKV) SetKey

func (k *AdminAppKV) SetKey(key string, value interface{}) error

func (*AdminAppKV) Update

func (k *AdminAppKV) Update(data map[string]interface{}) error

type AdminObjectKV

type AdminObjectKV struct {
	DB        *database.AdminDB
	ID        string
	Namespace string
}

func (*AdminObjectKV) DelKey

func (k *AdminObjectKV) DelKey(key string) error

func (*AdminObjectKV) Get

func (k *AdminObjectKV) Get() (map[string]interface{}, error)

func (*AdminObjectKV) GetKey

func (k *AdminObjectKV) GetKey(key string) (interface{}, error)

func (*AdminObjectKV) Set

func (k *AdminObjectKV) Set(data map[string]interface{}) error

func (*AdminObjectKV) SetKey

func (k *AdminObjectKV) SetKey(key string, value interface{}) error

func (*AdminObjectKV) Update

func (k *AdminObjectKV) Update(data map[string]interface{}) error

type AdminUserKV

type AdminUserKV struct {
	DB        *database.AdminDB
	ID        string
	Namespace string
}

func (*AdminUserKV) DelKey

func (k *AdminUserKV) DelKey(key string) error

func (*AdminUserKV) Get

func (k *AdminUserKV) Get() (map[string]interface{}, error)

func (*AdminUserKV) GetKey

func (k *AdminUserKV) GetKey(key string) (interface{}, error)

func (*AdminUserKV) Set

func (k *AdminUserKV) Set(data map[string]interface{}) error

func (*AdminUserKV) SetKey

func (k *AdminUserKV) SetKey(key string, value interface{}) error

func (*AdminUserKV) Update

func (k *AdminUserKV) Update(data map[string]interface{}) error

type KV

type KV interface {
	Get() (map[string]interface{}, error)
	Set(data map[string]interface{}) error
	Update(data map[string]interface{}) error

	SetKey(key string, value interface{}) error
	GetKey(key string) (interface{}, error)
	DelKey(key string) error
}

func AppAuth

func AppAuth(ctx *rest.Context, appid string, namespace string) (KV, error)

func ObjectAuth

func ObjectAuth(ctx *rest.Context, oid string, namespace string) (KV, error)

func UserAuth

func UserAuth(ctx *rest.Context, username string, namespace string) (KV, error)

Jump to

Keyboard shortcuts

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