storage

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2019 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrIndexOutOfRange is returned if an index is out of range.
	ErrIndexOutOfRange = errors.New("index out of range")
	// ErrEncodeDBVersion is returned if the database version fails to be encoded.
	ErrEncodeDBVersion = errors.New("failed to encode db version")
)

Functions

This section is empty.

Types

type Database

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

Database is a representation of the backend storage.

func Open

func Open(cfgFolder string) (*Database, error)

Open returns an instance of the database.

func (*Database) Add added in v0.5.0

func (d *Database) Add(c *clinote.Credential) error

Add adds a new credential to the database.

func (*Database) Close

func (d *Database) Close() error

Close shuts down the connection to the database.

func (*Database) GetAll added in v0.5.0

func (d *Database) GetAll() ([]*clinote.Credential, error)

GetAll returns all the credentials in the database.

func (*Database) GetByIndex added in v0.5.0

func (d *Database) GetByIndex(index int) (*clinote.Credential, error)

GetByIndex returns a credential by its index.

func (*Database) GetNoteRecoveryPoint added in v0.5.0

func (d *Database) GetNoteRecoveryPoint() (*clinote.Note, error)

GetNoteRecoveryPoint returns the saved note that failed to save.

func (*Database) GetNotebookCache

func (d *Database) GetNotebookCache() (*clinote.NotebookCacheList, error)

GetNotebookCache returns the stored NotebookCacheList.

func (*Database) GetSearch

func (d *Database) GetSearch() ([]*clinote.Note, error)

GetSearch gets the saved search from the database.

func (*Database) GetSettings

func (d *Database) GetSettings() (*clinote.Settings, error)

GetSettings returns the settings from the database.

func (*Database) Remove added in v0.5.0

func (d *Database) Remove(c *clinote.Credential) error

Remove removes the credential from the database.

func (*Database) SaveNoteRecoveryPoint added in v0.5.0

func (d *Database) SaveNoteRecoveryPoint(note *clinote.Note) error

SaveNoteRecoveryPoint saves the note to the database so it can be recovered in the case something fails.

func (*Database) SaveSearch

func (d *Database) SaveSearch(notes []*clinote.Note) error

SaveSearch stores the search to the database.

func (*Database) StoreNotebookList

func (d *Database) StoreNotebookList(list *clinote.NotebookCacheList) error

StoreNotebookList saves the list to the database.

func (*Database) StoreSettings

func (d *Database) StoreSettings(settings *clinote.Settings) error

StoreSettings saves the settings to the database.

Jump to

Keyboard shortcuts

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