backend

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package backend handles kdbx interactions

Package backend handles kdbx interactions

Package backend handles kdbx interactions

Package backend handles querying a store

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base added in v1.1.0

func Base(s string) string

Base will get the base name of input path

func Directory added in v1.1.0

func Directory(s string) string

Directory will get the directory/group for the given path

func IsDirectory added in v1.1.0

func IsDirectory(path string) bool

IsDirectory will indicate if a path looks like a group/directory

func NewPath

func NewPath(segments ...string) string

NewPath creates a new storage location path.

func NewSuffix

func NewSuffix(name string) string

NewSuffix creates a new user 'name' suffix

Types

type ActionMode

type ActionMode string

ActionMode represents activities performed via transactions

const (
	// MoveAction represents changes via moves, like the Move command
	MoveAction ActionMode = "mv"
	// InsertAction represents changes via inserts, like the Insert command
	InsertAction ActionMode = "insert"
	// RemoveAction represents changes via deletions, like Remove or globbed remove commands
	RemoveAction ActionMode = "rm"
)

type Context

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

Context handles operating on the underlying database

type Hook

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

Hook represents a runnable user-defined hook

func NewHook

func NewHook(path string, a ActionMode) (Hook, error)

NewHook will create a new hook type

func (Hook) Run

func (h Hook) Run(mode HookMode) error

Run will execute any scripts configured as hooks

type HookMode

type HookMode string

HookMode are hook operations the user can tie to

const (
	// HookPre are triggers BEFORE an action is performed on an entity
	HookPre HookMode = "pre"
	// HookPost are triggers AFTER an action is performed on an entity
	HookPost HookMode = "post"
)

type JSON added in v1.1.0

type JSON struct {
	ModTime string `json:"modtime"`
	Data    string `json:"data,omitempty"`
}

JSON is an entry as a JSON string

type QueryEntity

type QueryEntity struct {
	Path  string
	Value string
	// contains filtered or unexported fields
}

QueryEntity is the result of a query

func (QueryEntity) Directory

func (e QueryEntity) Directory() string

Directory gets the offset location of the entry without the 'name'

type QueryMode

type QueryMode int

QueryMode indicates HOW an entity will be found

const (

	// ListMode indicates ALL entities will be listed
	ListMode QueryMode
	// FindMode indicates a _contains_ search for an entity
	FindMode
	// ExactMode means an entity must MATCH the string exactly
	ExactMode
	// SuffixMode will look for an entity ending in a specific value
	SuffixMode
	// PrefixMode allows for entities starting with a specific value
	PrefixMode
)

type QueryOptions

type QueryOptions struct {
	Mode     QueryMode
	Values   ValueMode
	Criteria string
}

QueryOptions indicates how to find entities

type Transaction

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

Transaction handles the overall operation of the transaction

func Load

func Load(file string) (*Transaction, error)

Load will load a kdbx file for transactions

func NewTransaction

func NewTransaction() (*Transaction, error)

NewTransaction will use the underlying environment data store location

func (*Transaction) Get

func (t *Transaction) Get(path string, mode ValueMode) (*QueryEntity, error)

Get will request a singular entity

func (*Transaction) Insert

func (t *Transaction) Insert(path, val string) error

Insert is a move to the same location

func (*Transaction) MatchPath

func (t *Transaction) MatchPath(path string) ([]QueryEntity, error)

MatchPath will try to match 1 or more elements (more elements when globbing)

func (*Transaction) Move

func (t *Transaction) Move(src QueryEntity, dst string) error

Move will move a src object to a dst location

func (*Transaction) QueryCallback

func (t *Transaction) QueryCallback(args QueryOptions) ([]QueryEntity, error)

QueryCallback will retrieve a query based on setting

func (*Transaction) Remove

func (t *Transaction) Remove(entity *QueryEntity) error

Remove will remove a single entity

func (*Transaction) RemoveAll

func (t *Transaction) RemoveAll(entities []QueryEntity) error

RemoveAll handles removing elements

type ValueMode

type ValueMode int

ValueMode indicates what to do with the store value of the entity

const (
	// BlankValue will not decrypt secrets, empty value
	BlankValue ValueMode = iota
	// SecretValue will have the raw secret onboard
	SecretValue
	// JSONValue will show entries as a JSON payload
	JSONValue
)

Jump to

Keyboard shortcuts

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