storage

package
v0.0.0-...-64d1871 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Impl

type Impl struct {
	DB *gorm.DB
}

Impl represents a gorm.DB

func (*Impl) DeleteNote

func (i *Impl) DeleteNote(n Note) (err error)

DeleteNote deletes a note

func (*Impl) InitDB

func (i *Impl) InitDB() (err error)

InitDB tries to open db and creates one if needed

func (*Impl) InitSchema

func (i *Impl) InitSchema()

InitSchema initializes the schema

func (*Impl) ListNotes

func (i *Impl) ListNotes(f string) (n []Note)

ListNotes returns a list of all notes. If f is specified, filter results

func (*Impl) LoadNote

func (i *Impl) LoadNote(name string) (n Note, err error)

LoadNote loads a note and returns it if successful

func (*Impl) NoteExists

func (i *Impl) NoteExists(n string) bool

NoteExists returns true if note exist

func (*Impl) RemoveExpiredNotes

func (i *Impl) RemoveExpiredNotes() (err error)

RemoveExpiredNotes searches for temporary notes older then 24 hours and removes them

func (*Impl) RenameNote

func (i *Impl) RenameNote(nID uint, newName string) (err error)

RenameNote renames a notes

func (*Impl) SaveNote

func (i *Impl) SaveNote(n *Note) (err error)

SaveNote saves a note and returns it

func (*Impl) SearchNotes

func (i *Impl) SearchNotes(f string) (n []Note)

SearchNotes returns a list of notes matching f

type Note

type Note struct {
	gorm.Model
	Name      string `sql:"not null;primary_key;index"`
	Text      string
	Temporary bool
}

Note represents a note

Jump to

Keyboard shortcuts

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