storage

package
v0.0.0-...-fd24f7f Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	CreatedAt        time.Time
	Content          string
	Key              string
	DecryptedContent string
}

Entry stores entries with metadata

func (*Entry) Filter

func (entry *Entry) Filter(search, date string) (*Entry, bool)

Filter filters entries down by search term and date

func (*Entry) Format

func (entry *Entry) Format(verbose bool) (string, error)

Format pretty-prints an entry

func (*Entry) SetDecryptedContent

func (entry *Entry) SetDecryptedContent() error

SetDecryptedContent decrypts an entry's content and sets the plain value on the object

func (*Entry) Transform

func (entry *Entry) Transform(verbose bool, search string, date string) (string, error)

Transform prepares and entry for display

type Storage

type Storage struct{}

Storage implement all CRUD methods

func (*Storage) Create

func (s *Storage) Create(msg string) error

Create will save a message to the cloud, or a local file.

func (*Storage) Delete

func (s *Storage) Delete(key string) error

Delete will delete an entry by its unique key, from either the cloud or a local file.

func (*Storage) Read

func (s *Storage) Read() ([]Entry, error)

Read will read the content of all messages from the cloud or local file.

func (*Storage) ReadByKey

func (s *Storage) ReadByKey(key string) (Entry, error)

ReadByKey will read a single message from the cloud or local file, selected by key.

func (*Storage) Update

func (s *Storage) Update(e Entry) error

Update rewrites and entry in storage

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳