db

package
v0.0.0-...-4a985ec Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeySize   = 32
	NonceSize = 24
)

Variables

This section is empty.

Functions

func RandomString64

func RandomString64() string

Types

type DB

type DB struct {
	HomeCache    []*Mima
	RecycleCache []*Mima

	Directory string
	FullPath  string
	// contains filtered or unexported fields
}

func NewDB

func NewDB(directory string) *DB

func (*DB) ChangePassword

func (db *DB) ChangePassword(newPassword string) error

func (*DB) CheckPassword

func (db *DB) CheckPassword(password string) bool

func (*DB) Create

func (db *DB) Create(password string)

func (*DB) DeleteForever

func (db *DB) DeleteForever(id string) error

func (*DB) DeleteHistory

func (db *DB) DeleteHistory(id, datetime string) error

func (*DB) ExportAll

func (db *DB) ExportAll(filePath string) error

ExportAll without deleted items.

func (*DB) GetByAlias

func (db *DB) GetByAlias(alias string) (items []*Mima)

func (*DB) GetByID

func (db *DB) GetByID(id string) (i int, m *Mima, err error)

func (*DB) Init

func (db *DB) Init(password string) error

func (*DB) Insert

func (db *DB) Insert(m *Mima) error

Insert inserts a new Mima into the end of db.allItems. The db.allItems is sorted by Mima.UpdatedAt.

func (*DB) IsEmpty

func (db *DB) IsEmpty() bool

func (*DB) IsReady

func (db *DB) IsReady() bool

func (*DB) Len

func (db *DB) Len() int

func (*DB) RecoverByID

func (db *DB) RecoverByID(id string) error

func (*DB) RecycleByID

func (db *DB) RecycleByID(id string) error

func (*DB) Reset

func (db *DB) Reset()

func (*DB) Update

func (db *DB) Update(form *EditForm) error

func (*DB) WriteDatabase

func (db *DB) WriteDatabase(filePath string) error

type EditForm

type EditForm = mima.EditForm

type Mima

type Mima = mima.Mima

type Nonce

type Nonce = [NonceSize]byte

type Operation

type Operation = mima.Operation

type SecretKey

type SecretKey = [KeySize]byte

Jump to

Keyboard shortcuts

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