common

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: ISC Imports: 8 Imported by: 0

README

common

The types here are meant to be used as abstract classes and be extended by the actual implementations of each of the defined types. They provide implementations of functions where the logic is implementation-agnostic and can be shared across all backends

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareUUIDs

func CompareUUIDs(me t.UUIDer, them t.UUIDer) (bool, error)

func FindPathToGroup

func FindPathToGroup(source t.Group, target t.Group) (rv []t.Group, err error)

func FormatTime

func FormatTime(t time.Time) (formatted string)

Types

type Database

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

func (*Database) Backup

func (d *Database) Backup() error

Backup executes a backup, if the database exists, otherwise it will do nothing

func (*Database) BackupPath

func (d *Database) BackupPath() string

BackupPath returns the path to which a backup can be written or restored

func (*Database) Changed

func (d *Database) Changed() bool

func (*Database) CurrentLocation

func (d *Database) CurrentLocation() t.Group

CurrentLocation returns the group currently used as the user's shell location in the DB

func (*Database) Lock

func (d *Database) Lock() error

Lock generates a lockfile for the given database

func (*Database) Locked

func (d *Database) Locked() bool

Locked returns whether or not the lockfile exists

func (*Database) Path

func (d *Database) Path() (string, error)

Path will walk up the group hierarchy to determine the path to the current location

func (*Database) RemoveBackup

func (d *Database) RemoveBackup() error

RemoveBackup will delete the backup database

func (*Database) RestoreBackup

func (d *Database) RestoreBackup() error

RestoreBackup will restore a backup from the BackupPath() to the SavePath(). This will overwrite whatever's in the main location, handle with care

func (*Database) SavePath

func (d *Database) SavePath() string

SavePath returns the current save location for the DB

func (*Database) Search

func (d *Database) Search(term *regexp.Regexp) (paths []string, err error)

Search looks through a database for an entry matching a given term

func (*Database) SetChanged

func (d *Database) SetChanged(changed bool)

func (*Database) SetCurrentLocation

func (d *Database) SetCurrentLocation(g t.Group)

func (*Database) SetDriver

func (d *Database) SetDriver(driver t.Database)

SetDriver sets pointer to the version of itself that can access child methods... FIXME this is a bit of a mind bender

func (*Database) SetSavePath

func (d *Database) SetSavePath(newPath string)

func (*Database) Unlock

func (d *Database) Unlock() error

Unlock removes the lock file on the current savepath of the database

type Entry

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

func (*Entry) DB

func (e *Entry) DB() t.Database

func (*Entry) Output

func (e *Entry) Output(full bool) (val string)

func (*Entry) Parent

func (e *Entry) Parent() t.Group

func (*Entry) Path

func (e *Entry) Path() (path string, err error)

Path returns the fully qualified path to the entry, if there's no parent, only the name is returned

func (*Entry) Search

func (e *Entry) Search(term *regexp.Regexp) (paths []string, err error)

TODO test various fields to make sure they are searchable, consider adding searchability toggle

func (*Entry) SetDB

func (e *Entry) SetDB(db t.Database)

func (*Entry) SetDriver

func (e *Entry) SetDriver(entry t.Entry)

SetDriver sets pointer to the version of itself that can access child methods... FIXME this is a bit of a mind bender

func (*Entry) SetParent

func (e *Entry) SetParent(g t.Group) error

type Group

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

func (*Group) DB

func (g *Group) DB() t.Database

func (*Group) Path

func (g *Group) Path() (rv string, err error)

func (*Group) Search

func (g *Group) Search(term *regexp.Regexp) (paths []string, err error)

func (*Group) SetDB

func (g *Group) SetDB(d t.Database)

func (*Group) SetDriver

func (g *Group) SetDriver(gr t.Group)

SetDriver sets pointer to the version of itself that can access child methods... FIXME this is a bit of a mind bender

type Value

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

func NewValue

func NewValue(value []byte, name string, searchable bool, protected bool, readOnly bool, valueType t.ValueType) Value

NewValue initializes a value object

func (Value) FormattedValue

func (v Value) FormattedValue(full bool) string

FormattedValue returns the appropriately formatted value contents, with the `full` argument determining whether protected values should be returned in cleartext

func (Value) Name

func (v Value) Name() string

func (Value) Protected

func (v Value) Protected() bool

func (Value) ReadOnly

func (v Value) ReadOnly() bool

func (Value) Searchable

func (v Value) Searchable() bool

func (Value) Type

func (v Value) Type() t.ValueType

func (Value) Value

func (v Value) Value() []byte

Jump to

Keyboard shortcuts

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