Documentation
¶
Index ¶
- Variables
- func GetFileFromConfig(file string) string
- func Sha1(s string) string
- func Sha1File(file string) (string, error)
- type Book
- func (b *Book) Changed(noteIndex int)
- func (b *Book) DeleteNote(noteIndex int) error
- func (b *Book) HRModifiedTime() string
- func (book *Book) NewAttachment(noteDir, path string) error
- func (book *Book) NewNote(noteDir string, completion func()) error
- func (book *Book) NewNoteWithContentsOfFile(noteDir, path string, completion func()) error
- func (b *Book) SaveNoteIndex(noteIndex int) error
- func (n *Book) Sort()
- type CliOpts
- type Config
- type Note
- type NoteBook
- type S3Config
- func (c *S3Config) Decrypt(data []byte) ([]byte, error)
- func (c S3Config) DecryptAndDeGzip(file string) error
- func (c S3Config) Delete(s3File string) error
- func (c S3Config) DownloadFileFrom(s3File, endPath string) error
- func (c *S3Config) Encrypt(data []byte) ([]byte, error)
- func (c S3Config) GzipAndEncrypt(file string) (string, error)
- func (c S3Config) UploadFile(local, to string) error
- type SelfApp
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrBookExists = errors.New("book already exists")
Functions ¶
func GetFileFromConfig ¶
Types ¶
type Book ¶
type Book struct {
// Name is the sub-dir name
Name string `json:"name"`
// Notes contains all the notes in the sub-dir
Notes []*Note `json:"notes"`
Modified int64 `json:"modified"`
Selected bool `json:"selected"`
}
Book contains all the notes for the Name of the sub-categroies.
func (*Book) DeleteNote ¶
DeleteNote will delete a specific note. Will delete the note from s3 imetitly, and reupload the index files.
func (*Book) HRModifiedTime ¶
func (*Book) NewAttachment ¶
func (*Book) NewNoteWithContentsOfFile ¶
func (*Book) SaveNoteIndex ¶
SaveNoteIndex does the same thing as Note.Save(), but also updates the modified timestamp for the book.
type Config ¶
type Config struct {
App appSettings `ini:"settings"`
S3 S3Config `ini:"s3"`
}
func LoadConfig ¶
type Note ¶
type Note struct {
// S3Path is the path to the note on the s3 server. Also used for the local
// path when caching. eg. "catigory/uuid-1/content"
S3Path string `json:"path"`
Created int64 `json:"created"`
Modified int64 `json:"modified"`
Hash string `json:"hash"`
Title string `json:"title"`
// For attachments
IsAttachment bool `json:"attachment"`
AttachmentTitle string `json:"attachment_title"`
Size int64 `json:"size"`
}
Note is all the data for a specific note.
func (*Note) Changed ¶
func (n *Note) Changed()
Changed will update the modified date for a note. Depercated: use Book.Changed()
type NoteBook ¶
type NoteBook struct {
Books []*Book `json:"folders"`
}
NoteBook is the collection of all sub-categroies.
func (*NoteBook) DeleteBook ¶
func (*NoteBook) GetSelected ¶
func (*NoteBook) SetSelected ¶
type S3Config ¶
type S3Config struct {
Active bool `ini:"active"`
Bucket string `ini:"bucket"`
Endpoint string `ini:"endpoint"`
Region string `ini:"region"`
AccessKey string `ini:"accesskey"`
SecretKey string `ini:"secretkey"`
UserID string `ini:"user_id"`
CryptKey string `ini:"crypt_key"`
}
func (S3Config) DecryptAndDeGzip ¶
func (S3Config) DownloadFileFrom ¶
func (S3Config) UploadFile ¶
type SelfApp ¶
type SelfApp struct {
// Notes
Notes *NoteBook
// IndexNeedsUpdating indecates if the index file needs to be uploaded
// like if a new note was created.
IndexNeedsUpdating bool
// CLI opts
CliOpts CliOpts
Config *Config
}
func (*SelfApp) DeleteNote ¶
DeleteNote will delete a specific note. Will delete the note from s3 imetitly, and reupload the index files. Depercated: use Book.DeleteNote()
func (*SelfApp) SaveIndexFile ¶
Click to show internal directories.
Click to hide internal directories.
