databases

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

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

func Open

func Open(user, path string, encryptor encryption.Encryptor) *Database

Creates a connection to database. `path` is a path to your database, e.g. $HOME/passman/supersecret.db If you want to create a new database, put your desirable path to it as an argument.

func (*Database) Delete

func (d *Database) Delete(record Record)

Delete record from `storage` table matching by id.

func (*Database) Drop

func (d *Database) Drop()

Deletes the file where the entire database resides.

func (*Database) FindAll

func (d *Database) FindAll() []Record

Returns all records from table `storage` that belong to current user.

func (*Database) FindById

func (d *Database) FindById(id int64) *Record

Retrieves records from `storage` table matching by id.

func (*Database) FindByService

func (d *Database) FindByService(service string) []Record

Retrieves records from `storage` table matching by service.

func (*Database) Insert

func (d *Database) Insert(record *Record)

Inserts a record into `storage` table.

func (*Database) Update

func (d *Database) Update(record Record)

Updates the data in `storage` table matching by id.

type EncryptedRecord

type EncryptedRecord struct {
	Data []byte
	// contains filtered or unexported fields
}

func (EncryptedRecord) Decrypt

func (r EncryptedRecord) Decrypt(encryptor encryption.Encryptor) (Record, error)

type Record

type Record struct {
	Owner   string
	Service string
	Data    []byte
	Id      int64
}

func (Record) Encrypt

func (r Record) Encrypt(encryptor encryption.Encryptor) EncryptedRecord

func (Record) MarshalJSON

func (r Record) MarshalJSON() ([]byte, error)

func (*Record) UnmarshalJSON

func (r *Record) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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