notesmarket

package
v0.0.0-...-abc261f Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultEditor = "vim"
)
View Source
const (
	IdToRemove = "removed"
)

Variables

This section is empty.

Functions

func CreateNote

func CreateNote()

Types

type Book

type Book struct {
	Name  string
	Notes NoteSet
	// contains filtered or unexported fields
}

Book may contains multiple notes. Each book has its own directory. Notes may be duplicated to different locations. ByProject, ByTags, ByMonth

func NewBook

func NewBook() *Book

func (*Book) AddNote

func (b *Book) AddNote(n Note)

func (*Book) EditNote

func (b *Book) EditNote(n Note) bool

func (*Book) RemoveNote

func (b *Book) RemoveNote(n *Note)

func (*Book) UpdateBook

func (b *Book) UpdateBook()

func (*Book) UpdateTags

func (b *Book) UpdateTags() map[string][]*Note

type Market

type Market struct {
	Books     map[string]*Book
	PageBooks map[string]*PageBook
}

Market is the manager of the whole notes system. A market may contains multiple books, and each book may contains multiple notes. Market is also responsible to serialize all notes to files and load them.

func GetNotesMarket

func GetNotesMarket() *Market

func (*Market) GetOrCreateBook

func (m *Market) GetOrCreateBook(bookName string) *Book

func (*Market) GetOrCreatePageBook

func (m *Market) GetOrCreatePageBook(bookName string) *PageBook

func (*Market) Reload

func (m *Market) Reload()

func (*Market) SaveAll

func (m *Market) SaveAll()

type Note

type Note struct {
	Id           string
	Title        string
	Content      string
	Project      string
	Tags         []string
	CreationTime string // RFC3339 format of creation time, used as unique key
	Archived     bool
}

Note is the basic unit of the notes system.

func EmptyNote

func EmptyNote() Note

type NoteFile

type NoteFile struct {
	// contains filtered or unexported fields
}

NoteFile keep several notes in one markdown file

func NewNoteFile

func NewNoteFile(notePath string) *NoteFile

type NoteSet

type NoteSet struct {
	// contains filtered or unexported fields
}

func NewNoteSet

func NewNoteSet() NoteSet

func (*NoteSet) GetNote

func (ns *NoteSet) GetNote(key string) Note

func (*NoteSet) HasNoteById

func (ns *NoteSet) HasNoteById(key string) bool

func (*NoteSet) ToOrderedList

func (ns *NoteSet) ToOrderedList() []*Note

type PageBook

type PageBook struct {
	Name string
	// abs path to title mapping
	Pages map[string]string
}

func NewPageBook

func NewPageBook(name string) *PageBook

func (*PageBook) ReloadAll

func (pb *PageBook) ReloadAll()

func (*PageBook) UpdateToc

func (pb *PageBook) UpdateToc()

Jump to

Keyboard shortcuts

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