model

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Username string `db:"username" json:"username"`
	Password string `db:"password" json:"password"`
}

Account is used

type Note

type Note struct {
	ID          int64     `db:"id"`
	Title       string    `db:"title"`
	Memo        string    `db:"memo"`
	Created     time.Time `db:"created"`
	LastUpdated time.Time `db:"lastUpdated"`
	Tags        map[string]bool
	NotebookID  int64 `db:"notebook_id"`
}

Note is the note we want to keep.

func NewNote

func NewNote(title, memo string, notebookID int64, tags []string) *Note

NewNote returns a new note pointer.

func (*Note) AddTags

func (note *Note) AddTags(tags []string)

AddTags add one or more tags to note (also updates the LastUpdate value)

func (*Note) RemoveTags

func (note *Note) RemoveTags(tags []string)

RemoveTags removes tags (also updates the LastUpdate value)

func (*Note) UpdateMemo

func (note *Note) UpdateMemo(newMemo string)

UpdateMemo updates the memo (also updates the LastUpdate value)

func (*Note) UpdateNotebook

func (note *Note) UpdateNotebook(notebookID int64)

UpdateNotebook updates the notebook this note belongs to (also updates the LastUpdate value)

func (*Note) UpdateTags

func (note *Note) UpdateTags(tags []string)

UpdateTags updates tags (also updates the LastUpdate value)

func (*Note) UpdateTitle

func (note *Note) UpdateTitle(newTitle string)

UpdateTitle updates the title of the note (also updates the LastUpdate value)

type Notebook

type Notebook struct {
	ID    int64  `db:"id"`
	Title string `db:"title"`
	Notes map[int64]*Note
}

Notebook holds a list of "similar" notes

func NewNotebook

func NewNotebook(title string) *Notebook

NewNotebook returns a Notebook pointer

func (*Notebook) AddNote

func (nBook *Notebook) AddNote(note *Note) bool

AddNote adds note to Notebook list, also update the note with current Notebook

func (*Notebook) RemoveNote

func (nBook *Notebook) RemoveNote(noteID int64) bool

RemoveNote remove note from Notebook list. WARNING: when removing a note we should add it to a default notebook.

Jump to

Keyboard shortcuts

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