Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileStorage ¶
type FileStorage struct {
Path string
// contains filtered or unexported fields
}
func NewFileStorage ¶
func NewFileStorage(path string) *FileStorage
func (*FileStorage) All ¶
func (s *FileStorage) All(o Order) ([]string, error)
All returns all entries from the file.
func (*FileStorage) Append ¶
func (s *FileStorage) Append(entry string) error
Append the entry as a new line at the end of the file.
func (*FileStorage) Latest ¶
func (s *FileStorage) Latest() (*string, error)
Latest returns the most recently added entry.
func (*FileStorage) Pop ¶
func (s *FileStorage) Pop() error
Pop removes the last line from the file.
type SQLConnectionDetails ¶
type SQLStorage ¶
type SQLStorage struct {
// contains filtered or unexported fields
}
func NewSQLStorage ¶
func NewSQLStorage(scd *SQLConnectionDetails) *SQLStorage
func (*SQLStorage) All ¶
func (s *SQLStorage) All(o Order) ([]string, error)
All returns all entries from the database.
func (*SQLStorage) Append ¶
func (s *SQLStorage) Append(entry string) error
Append inserts a new record for that entry into the database.
func (*SQLStorage) Latest ¶
func (s *SQLStorage) Latest() (*string, error)
Latest returns the most recent record (according to the migration date).
func (*SQLStorage) Open ¶
func (s *SQLStorage) Open() error
func (*SQLStorage) Pop ¶
func (s *SQLStorage) Pop() error
Pop deletes the most recent record (according to the migration date).
type Storage ¶
type Storage interface {
// Open a connection to the storage medium.
Open() error
// Close connection safely. This should be deferred after a call of Open.
Close() error
// Append (and persist) a new entry to the storage.
Append(string) error
// Pop removes the most recently added entry from the storage.
Pop() error
// All returns all items from the storage in ascending order.
All(Order) ([]string, error)
// Latest returns the latest/most recent item from the storage.
Latest() (*string, error)
}
Storage represents a stack-like (i.e., simple string values in a LIFO manner) persistence management interface.
Click to show internal directories.
Click to hide internal directories.