app

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(content string, password string) (string, error)

Decrypt a string given the provided password

func Encrypt

func Encrypt(content string, password string) (string, error)

Encrypt a string given the provided password

func Map added in v0.1.0

func Map(notes Notes) map[string]Note

Map of notes key'd by uid

func SmellsEncrypted

func SmellsEncrypted(content string) bool

SmellsEncrypted - Try to guess if a string is encrypted or not

Types

type APIResponse

type APIResponse struct {
	Message string `json:"message"`
	Success bool   `json:"success"`
}

APIResponse - Envelope to communicate details to the frontent

type Note

type Note struct {
	Content   string `json:"content"`
	Created   string `json:"created"`
	Encrypted bool   `json:"encrypted"`
	Password  string `json:"password"`
	Subject   string `json:"subject"`
	Tags      string `json:"tags"`
	UID       string `json:"uid"`
	Updated   string `json:"updated"`

	// Fields largely to support the `-secondary` feature
	AheadOfPrimary bool      `json:"ahead_of_primary"`
	Deleted        bool      `json:"deleted"`
	Time           time.Time `json:"time"`

	// Private fields
	SecondaryPath string `json:"-"`
}

Note represents a single note stored by the application

func Persistable

func Persistable(note Note) (Note, error)

Persistable prepares a note for being persisted to storage

func (*Note) FromBytes

func (note *Note) FromBytes(b []byte) error

FromBytes converts encoding.Gob bytes into a Note

func (Note) ToBytes

func (note Note) ToBytes() ([]byte, error)

ToBytes converts a raw note into encoding.Gob bytes

func (Note) ToJSON

func (note Note) ToJSON() (string, error)

ToJSON converts a (filtered) note into json fields filtered: - Content: For performance reasons - Password: For security reasons

type Notes

type Notes []Note

Notes is a collection of Note objects

type TimeSorter

type TimeSorter Notes

TimeSorter sorts notes lines by last updated

func (TimeSorter) Len

func (a TimeSorter) Len() int

func (TimeSorter) Less

func (a TimeSorter) Less(i, j int) bool

func (TimeSorter) Swap

func (a TimeSorter) Swap(i, j int)

Jump to

Keyboard shortcuts

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