Documentation ¶
Index ¶
- Variables
- func CheckUpdate(ctx infra.DnoteCtx) error
- func DeleteSystem(db *infra.DB, key string) error
- func GetBookUUID(ctx infra.DnoteCtx, label string) (string, error)
- func GetCipherKey(ctx infra.DnoteCtx) ([]byte, error)
- func GetConfigPath(ctx infra.DnoteCtx) string
- func GetDnoteTmpContentPath(ctx infra.DnoteCtx) string
- func GetEditorInput(ctx infra.DnoteCtx, fpath string, content *string) error
- func GetSystem(db *infra.DB, key string, dest interface{}) error
- func GetValidSession(ctx infra.DnoteCtx) (string, bool, error)
- func InitFiles(ctx infra.DnoteCtx) error
- func InitSystem(ctx infra.DnoteCtx) error
- func InsertSystem(db *infra.DB, key, val string) error
- func LogAction(tx *sql.Tx, schema int, actionType, data string, timestamp int64) error
- func ReadConfig(ctx infra.DnoteCtx) (infra.Config, error)
- func SanitizeContent(s string) string
- func UpdateSystem(db *infra.DB, key, val interface{}) error
- func UpsertSystem(db *infra.DB, key, val string) error
- func WriteConfig(ctx infra.DnoteCtx, config infra.Config) error
- type Book
- type Note
- type RunEFunc
Constants ¶
This section is empty.
Variables ¶
var ( // ConfigFilename is the name of the config file ConfigFilename = "dnoterc" // TmpContentFilename is the name of the temporary file that holds editor input TmpContentFilename = "DNOTE_TMPCONTENT" )
Functions ¶
func CheckUpdate ¶ added in v0.4.2
CheckUpdate triggers update if needed
func DeleteSystem ¶ added in v0.6.0
DeleteSystem delets the given system record
func GetBookUUID ¶ added in v0.4.5
GetBookUUID returns a uuid of a book given a label
func GetCipherKey ¶ added in v0.6.0
GetCipherKey retrieves the cipher key and decode the base64 into bytes.
func GetConfigPath ¶
GetConfigPath returns the path to the dnote config file
func GetDnoteTmpContentPath ¶
GetDnoteTmpContentPath returns the path to the temporary file containing content being added or edited
func GetEditorInput ¶
GetEditorInput gets the user input by launching a text editor and waiting for it to exit
func GetSystem ¶ added in v0.6.0
GetSystem scans the given system configuration record onto the destination
func GetValidSession ¶ added in v0.6.0
GetValidSession returns a session key from the local storage if one exists and is not expired If one does not exist or is expired, it prints out an instruction and returns false
func InitFiles ¶ added in v0.4.3
InitFiles creates, if necessary, the dnote directory and files inside
func InitSystem ¶ added in v0.4.9
InitSystem inserts system data if missing
func InsertSystem ¶ added in v0.6.0
InsertSystem inserets a system configuration
func ReadConfig ¶
ReadConfig reads the config file
func UpdateSystem ¶ added in v0.6.0
UpdateSystem updates a system configuration
func UpsertSystem ¶ added in v0.6.0
UpsertSystem inserts or updates a system configuration
Types ¶
type Book ¶ added in v0.4.9
type Book struct { UUID string `json:"uuid"` Label string `json:"label"` USN int `json:"usn"` Notes []Note `json:"notes"` Deleted bool `json:"deleted"` Dirty bool `json:"dirty"` }
Book holds a metadata and its notes
type Note ¶ added in v0.4.9
type Note struct { UUID string `json:"uuid"` BookUUID string `json:"book_uuid"` Body string `json:"content"` AddedOn int64 `json:"added_on"` EditedOn int64 `json:"edited_on"` USN int `json:"usn"` Public bool `json:"public"` Deleted bool `json:"deleted"` Dirty bool `json:"dirty"` }
Note represents a note
func NewNote ¶
func NewNote(uuid, bookUUID, body string, addedOn, editedOn int64, usn int, public, deleted, dirty bool) Note
NewNote constructs a note with the given data