postgres

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2017 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidArguments = errors.New("Invalid arguments given to PostgreSQL database")

ErrInvalidArguments invalid arguments were given

Functions

This section is empty.

Types

type Database

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

Database provides an interface to PostgreSQL

func NewDatabase

func NewDatabase(options ...string) (*Database, error)

NewDatabase returns a data Database

func (*Database) Close

func (d *Database) Close() error

Close closes the database

func (*Database) CreateBook

func (d *Database) CreateBook(b *note.Book) error

CreateBook saves the Book to the database

func (*Database) CreateNote

func (d *Database) CreateNote(n *note.Note) error

CreateNote saves the note to the database

func (*Database) CreateTag

func (d *Database) CreateTag(t *note.Tag) error

CreateTag saves the tag to the database

func (*Database) DeleteBook

func (d *Database) DeleteBook(bk *note.Book) error

DeleteBook deletes the Book from the database

func (*Database) DeleteNote

func (d *Database) DeleteNote(n *note.Note) error

DeleteNote delete note from database

func (*Database) EditBook

func (d *Database) EditBook(b *note.Book) error

EditBook change the book name

func (*Database) EditNote

func (d *Database) EditNote(n *note.Note) error

func (*Database) EditNoteByIDBook

func (d *Database) EditNoteByIDBook(ids []int64, bk *note.Book) error

EditNoteByIDBook updates all notes for the given IDs with the Book bk's ID

func (*Database) GetAllBookNotes

func (d *Database) GetAllBookNotes(book *note.Book, sortBy, order string) (note.Notes, error)

GetAllBookNotes returns all notes for the given Notebook

func (*Database) GetAllBookTags

func (d *Database) GetAllBookTags(bk *note.Book) (note.Tags, error)

GetAllBookTags returns all tags for the given Book

func (*Database) GetAllBooks

func (d *Database) GetAllBooks() (note.Books, error)

GetAllBooks returns all Books

func (*Database) GetAllNotes

func (d *Database) GetAllNotes(sortBy, order string) (note.Notes, error)

GetAllNotes returns all notes

func (*Database) GetAllNotesByIDs

func (d *Database) GetAllNotesByIDs(ids []int64) (note.Notes, error)

GetAllNotesByIDs returns all notes for the given Notebook

func (*Database) GetAllTags

func (d *Database) GetAllTags() (note.Tags, error)

GetAllTags returns all tags

func (*Database) GetBookByName

func (d *Database) GetBookByName(name string) (*note.Book, error)

GetBookByName returns the Book for the given name

func (*Database) GetNoteByID

func (d *Database) GetNoteByID(id int64) (*note.Note, error)

GetNoteByID returns the note for the given ID

func (*Database) GetNoteByNote

func (d *Database) GetNoteByNote(n *note.Note) error

GetNoteByNote Loads the note's ID, Created, and Modified fields

func (*Database) GetOrCreateBookByName

func (d *Database) GetOrCreateBookByName(name string) (*note.Book, error)

GetOrCreateBookByName gets the Book by name creating it if it does not exists

func (*Database) GetOrCreateTagByName

func (d *Database) GetOrCreateTagByName(name string) (*note.Tag, error)

GetOrCreateTagByName returns a tag, creating it if it does not exists

func (*Database) GetTableNames

func (d *Database) GetTableNames() ([]string, error)

GetTableNames returns a list of all table names

func (*Database) GetTagByName

func (d *Database) GetTagByName(name string) (*note.Tag, error)

GetTagByName returns the tag with the given name

func (*Database) GetTagsByName

func (d *Database) GetTagsByName(name string) (*note.Tag, error)

GetTagsByName returns the Tag for the given name

func (*Database) LoadBook

func (d *Database) LoadBook(b *note.Book) error

LoadBook loads the Note's Book

func (*Database) LoadNoteTags

func (d *Database) LoadNoteTags(n *note.Note) error

LoadNoteTags loads all the tags for the given Note

func (*Database) MergeBooks

func (d *Database) MergeBooks(b1 *note.Book, b2 *note.Book) error

MergeBooks merge all notes from Book b1 into Book b2

func (*Database) ResetTables

func (d *Database) ResetTables() error

Jump to

Keyboard shortcuts

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