services

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package services includes models and services that communicate with the database

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearAllKeysHistory

func ClearAllKeysHistory(tx *sql.Tx, prefix string)

func ClearKeyHistory

func ClearKeyHistory(tx *sql.Tx, key string)

func GetValue

func GetValue(tx *sql.Tx, key string) (*string, *time.Time)

func HideKey added in v0.2.0

func HideKey(tx *sql.Tx, key string)

func ListKeys

func ListKeys(tx *sql.Tx, prefix string, matchType MatchType) []string

func LockKey

func LockKey(tx *sql.Tx, key string, password string)

func PruneKey

func PruneKey(tx *sql.Tx, key string)

func RenameKey

func RenameKey(tx *sql.Tx, oldKey string, newKey string)

func RunInTransaction added in v0.1.4

func RunInTransaction(fn func(tx *sql.Tx))

RunInTransaction automatically cleans up DB then runs given function, all inside a transaction.

func SetValue

func SetValue(tx *sql.Tx, key string, value string, expiresAt *time.Time, isLocked bool)

func ShowKey added in v0.2.0

func ShowKey(tx *sql.Tx, key string)

func UnlockKey

func UnlockKey(tx *sql.Tx, key string, password string) error

Types

type KVItem

type KVItem struct {
	Key       string     `json:"key,omitempty" yaml:"key,omitempty"`
	Value     string     `json:"value,omitempty" yaml:"value,omitempty"`
	IsLocked  bool       `json:"isLocked,omitempty" yaml:"is-locked,omitempty"`
	IsHidden  bool       `json:"isHidden,omitempty" yaml:"is-hidden,omitempty"`
	ExpiresAt *time.Time `json:"expiresAt,omitempty" yaml:"expires-at,omitempty"`
	Timestamp time.Time  `json:"timestamp" yaml:"timestamp"`
}

func GetHistoryItem

func GetHistoryItem(tx *sql.Tx, key string, steps int) KVItem

func GetItem

func GetItem(tx *sql.Tx, key string) *KVItem

func ListItems

func ListItems(tx *sql.Tx, prefix string, matchType MatchType) []KVItem

func ListKeyHistory

func ListKeyHistory(tx *sql.Tx, key string) []KVItem

func (KVItem) String

func (item KVItem) String() string

type MatchType

type MatchType int
const (
	MatchAll MatchType = iota
	MatchExisting
	MatchDeleted
)

Jump to

Keyboard shortcuts

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