core

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2018 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func CheckUpdate(ctx infra.DnoteCtx) error

CheckUpdate triggers update if needed

func GetBookUUID added in v0.4.5

func GetBookUUID(ctx infra.DnoteCtx, label string) (string, error)

GetBookUUID returns a uuid of a book given a label

func GetConfigPath

func GetConfigPath(ctx infra.DnoteCtx) string

GetConfigPath returns the path to the dnote config file

func GetDnoteTmpContentPath

func GetDnoteTmpContentPath(ctx infra.DnoteCtx) string

GetDnoteTmpContentPath returns the path to the temporary file containing content being added or edited

func GetEditorInput

func GetEditorInput(ctx infra.DnoteCtx, fpath string, content *string) error

GetEditorInput gets the user input by launching a text editor and waiting for it to exit

func InitFiles added in v0.4.3

func InitFiles(ctx infra.DnoteCtx) error

InitFiles creates, if necessary, the dnote directory and files inside

func LogAction

func LogAction(tx *sql.Tx, schema int, actionType, data string, timestamp int64) error

LogAction logs action and updates the last_action

func LogActionAddBook

func LogActionAddBook(tx *sql.Tx, name string) error

LogActionAddBook logs an action for adding a book

func LogActionAddNote

func LogActionAddNote(tx *sql.Tx, noteUUID, bookName, content string, timestamp int64) error

LogActionAddNote logs an action for adding a note

func LogActionEditNote

func LogActionEditNote(tx *sql.Tx, noteUUID, bookName, content string, ts int64) error

LogActionEditNote logs an action for editing a note

func LogActionRemoveBook

func LogActionRemoveBook(tx *sql.Tx, name string) error

LogActionRemoveBook logs an action for removing book

func LogActionRemoveNote

func LogActionRemoveNote(tx *sql.Tx, noteUUID, bookName string) error

LogActionRemoveNote logs an action for removing a book

func ReadConfig

func ReadConfig(ctx infra.DnoteCtx) (infra.Config, error)

ReadConfig reads the config file

func Reduce

func Reduce(ctx infra.DnoteCtx, tx *sql.Tx, action actions.Action) error

Reduce transitions the local dnote state by consuming the action returned from the server

func ReduceAll

func ReduceAll(ctx infra.DnoteCtx, tx *sql.Tx, actionSlice []actions.Action) error

ReduceAll reduces all actions

func SanitizeContent

func SanitizeContent(s string) string

SanitizeContent sanitizes note content

func WriteConfig

func WriteConfig(ctx infra.DnoteCtx, config infra.Config) error

WriteConfig writes the config to the config file

Types

type RunEFunc

type RunEFunc func(*cobra.Command, []string) error

RunEFunc is a function type of dnote commands

Jump to

Keyboard shortcuts

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