database

package
v0.0.0-...-2ce84b7 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	DB   *sql.DB
	Sess *session.Manager
	sync.Mutex
	// contains filtered or unexported fields
}

func (*DB) AddPatchSetTitle

func (db *DB) AddPatchSetTitle(id, patch, title string) (
	count int, err error)

func (*DB) AddTagGroup

func (db *DB) AddTagGroup(group *TagGroup) error

func (*DB) AllDeletedNotes

func (db *DB) AllDeletedNotes() (notes []*Note, err error)

func (*DB) AllNotes

func (db *DB) AllNotes() (notes []*Note, err error)

func (*DB) AllReminders

func (db *DB) AllReminders() (notes []*Note, err error)

func (*DB) AllTagGroups

func (db *DB) AllTagGroups() (groups []TagGroup, err error)

func (*DB) AllTagsByDate

func (db *DB) AllTagsByDate() (tags []Tag, err error)

AllTagsByDate fetches all tags, sorted by "CreatedAt".

func (*DB) AllTagsByName

func (db *DB) AllTagsByName() (tags []Tag, err error)

AllTags fetches all tags, sorted by "Name".

func (*DB) ChangeReminder

func (db *DB) ChangeReminder(id, remindAt string) error

func (*DB) ChangeType

func (db *DB) ChangeType(id string, noteType NoteType) error

ChangeType 同时也可能需要修改标题。

func (*DB) Close

func (db *DB) Close() error

func (*DB) DeleteNoteForever

func (db *DB) DeleteNoteForever(id string) error

func (*DB) DeleteTag

func (db *DB) DeleteTag(id string) error

DeleteTag .

func (*DB) Exec

func (db *DB) Exec(query string, args ...interface{}) (err error)

func (*DB) ExportAllNotes

func (db *DB) ExportAllNotes() (notes []Note, err error)

func (*DB) GetByID

func (db *DB) GetByID(id string) (note Note, err error)

func (*DB) GetGroupsByTagID

func (db *DB) GetGroupsByTagID(tagID string) (groups [][]SimpleTag, err error)

func (*DB) GetNotesByTagID

func (db *DB) GetNotesByTagID(tagID string) ([]*Note, error)

func (*DB) GetTagByID

func (db *DB) GetTagByID(id string) (tag Tag, err error)

func (*DB) GetTagByName

func (db *DB) GetTagByName(name string) (tag Tag, err error)

func (*DB) GetTotalSize

func (db *DB) GetTotalSize() (size int, err error)

func (*DB) ImportNotes

func (db *DB) ImportNotes(notes []Note) (err error)

func (*DB) Insert

func (db *DB) Insert(note *Note) error

Insert .

func (*DB) NewNote

func (db *DB) NewNote(
	title, patch, remindAt string, noteType NoteType, tagNames []string) (*Note, error)

NewNote .

func (*DB) Open

func (db *DB) Open(dbPath string) (err error)

func (*DB) RenameTag

func (db *DB) RenameTag(id, newName string) (tagID string, err error)

RenameTag .

func (*DB) ResetCurrentID

func (db *DB) ResetCurrentID() (newid string, err error)

func (*DB) SearchTagGroup

func (db *DB) SearchTagGroup(tagNames []string) ([]*Note, error)

SearchTagGroup 通过标签组搜索笔记。

func (*DB) SearchTitle

func (db *DB) SearchTitle(pattern string) (notes []*Note, err error)

func (*DB) SetNoteDeleted

func (db *DB) SetNoteDeleted(id string, deleted bool) error

func (*DB) SetTagGroupProtected

func (db *DB) SetTagGroupProtected(groupID string, protected bool) error

SetTagGroupProtected .

func (*DB) UpdateTags

func (db *DB) UpdateTags(id string, tagNames []string) error

UpdateTags .

type IncreaseID

type IncreaseID = model.IncreaseID

type Note

type Note = model.Note

type NoteType

type NoteType = model.NoteType

type Row

type Row interface {
	Scan(...interface{}) error
}

type Set

type Set = stringset.Set

type SimpleTag

type SimpleTag = tagset.Tag

type Stmt

type Stmt = sql.Stmt

type TX

type TX interface {
	Exec(string, ...interface{}) (sql.Result, error)
	QueryRow(string, ...interface{}) *sql.Row
	Prepare(string) (*Stmt, error)
}

type Tag

type Tag = model.Tag

type TagGroup

type TagGroup = model.TagGroup

Jump to

Keyboard shortcuts

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