Documentation ¶
Index ¶
- type DB
- func (db *DB) Active() EntryList
- func (db *DB) Add(entry *Entry) int
- func (db *DB) All() EntryList
- func (db *DB) Count() int
- func (db *DB) Import(data []byte) (int, error)
- func (db *DB) Inactive() EntryList
- func (db *DB) PurgeInactive()
- func (db *DB) SetActive(id int)
- func (db *DB) SetInactive(id int)
- func (db *DB) TagMap() map[string]EntryList
- func (db *DB) ToJSON() ([]byte, error)
- type Entry
- type EntryList
- func (list EntryList) Export() (string, error)
- func (list EntryList) FilterActive() EntryList
- func (list EntryList) FilterByAll(queries ...string) EntryList
- func (list EntryList) FilterByAny(queries ...string) EntryList
- func (list EntryList) FilterByID(ids ...int) EntryList
- func (list EntryList) FilterByTag(tag string) EntryList
- func (list EntryList) FilterInactive() EntryList
- type ExportEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct { Version int `json:"version"` CachePass string `json:"cachepass"` Entries []*Entry `json:"entries"` }
DB represents an in-memory database of password records.
func (*DB) Import ¶
Import adds entries to the database from JSON. The entries must have been exported using an EntryList's Export() method. Returns the number of new entrie.
func (*DB) PurgeInactive ¶
func (db *DB) PurgeInactive()
Purge clears inactive entries from the database.
func (*DB) SetInactive ¶
SetInactive sets an entry's active status to false.
type Entry ¶
type Entry struct { Id int `json:"id"` Active bool `json:"active"` Title string `json:"title"` Url string `json:"url"` Username string `json:"username"` Passwords []string `json:"passwords"` Email string `json:"email"` Tags []string `json:"tags"` Notes string `json:"notes"` }
An Entry object represents a single database record.
func (*Entry) GetPassword ¶
GetPassword returns the newest password from the passwords list.
func (*Entry) SetPassword ¶
SetPassword appends a new password to the passsword list.
type EntryList ¶
type EntryList []*Entry
An EntryList is a slice of Entry pointers.
func (EntryList) FilterActive ¶
FilterActive returns a new EntryList containing active entries.
func (EntryList) FilterByAll ¶
FilterByAll returns a new EntryList containing entries which match *all* of the specified query strings, where each query string is a case-insensitive substring of the entry title. If a single query string is supplied, it will first be checked to see if it matches a valid entry ID.
func (EntryList) FilterByAny ¶
FilterByAny returns a new EntryList containing entries which match *any* of the specified query strings. A query string can be an entry ID or a case-insensitive substring of an entry title.
func (EntryList) FilterByID ¶
FilterByID returns a new EntryList containing entries with matching IDs.
func (EntryList) FilterByTag ¶
FilterByTag returns a new EntryList containing entries which match the specified tag. Matches are case-insensitive.
func (EntryList) FilterInactive ¶
FilterInactive returns a new EntryList containing inactive entries.
type ExportEntry ¶
type ExportEntry struct { Title string `json:"title"` Url string `json:"url"` Username string `json:"username"` Passwords []string `json:"passwords"` Email string `json:"email"` Tags []string `json:"tags"` Notes string `json:"notes"` }
An ExportEntry object represents a database record prepared for export.