Documentation ¶
Index ¶
- type DB
- func (db *DB) Active() EntryList
- func (db *DB) Add(entry *Entry)
- func (db *DB) All() EntryList
- 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) Size() int
- func (db *DB) TagMap() map[string]EntryList
- func (db *DB) ToJSON() (data []byte, err error)
- type Entry
- type EntryList
- func (list EntryList) Contains(entry *Entry) bool
- 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) FilterByIDString(queries ...string) 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 ¶
DB represents an in-memory database of password records.
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 filters an EntryList returning only those entries which are active.
func (EntryList) FilterByAll ¶
FilterByAll filters an EntryList returning 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 filters an EntryList returning entries which match *any* of the specified query strings. Each query string can be an entry ID or a case-insensitive substring of an entry title.
func (EntryList) FilterByIDString ¶
FilterByIDString filters an EntryList returning only those entries which match the specified query strings where each query string is an entry ID.
func (EntryList) FilterByTag ¶
FilterByTag filters an EntryList returning only those entries which match the specified tag. Matches are case-insensitive.
func (EntryList) FilterInactive ¶
FilterInactive filters an EntryList returning only those entries which are inactive.
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.