db

package
v0.0.0-...-69e0e94 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2014 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Demo

func Demo()

Types

type DBHandle

type DBHandle struct {
	ORM orm.Ormer
	// contains filtered or unexported fields
}

func NewDBHandle

func NewDBHandle(db_path string, verbose bool) (*DBHandle, error)

func NewMemoryDBHandle

func NewMemoryDBHandle(db_path string, verbose bool) (*DBHandle, error)

func (*DBHandle) AddTodoToAllPeople

func (dbh *DBHandle) AddTodoToAllPeople(t *Todo) error

func (*DBHandle) CreateNote

func (dbh *DBHandle) CreateNote(p *Note) error

func (*DBHandle) CreatePerson

func (dbh *DBHandle) CreatePerson(p *Person) error

func (*DBHandle) CreateTodo

func (dbh *DBHandle) CreateTodo(t *Todo) error

func (*DBHandle) GetNoteById

func (dbh *DBHandle) GetNoteById(id int64) (*Note, error)

func (*DBHandle) GetNotesById

func (dbh *DBHandle) GetNotesById(ids []int64) ([]*Note, error)

Returns all people if ids arguement is empty

func (*DBHandle) GetPeopleById

func (dbh *DBHandle) GetPeopleById(ids []int64) ([]*Person, error)

Returns all people if ids arguement is empty

func (*DBHandle) GetPersonById

func (dbh *DBHandle) GetPersonById(id int64) (*Person, error)

func (*DBHandle) GetTodoById

func (dbh *DBHandle) GetTodoById(id int64) (*Todo, error)

func (*DBHandle) GetTodos

func (dbh *DBHandle) GetTodos() ([]*Todo, error)

func (*DBHandle) GetTodosByIds

func (dbh *DBHandle) GetTodosByIds(ids []int64) ([]*Todo, error)

func (*DBHandle) RemoveNote

func (dbh *DBHandle) RemoveNote(note *Note) error

func (*DBHandle) RemoveTodo

func (dbh *DBHandle) RemoveTodo(t *Todo) error

func (*DBHandle) UpdateNote

func (dbh *DBHandle) UpdateNote(note *Note) error

func (*DBHandle) UpdatePerson

func (dbh *DBHandle) UpdatePerson(*Person) error

func (*DBHandle) UpdateTodo

func (dbh *DBHandle) UpdateTodo(t *Todo) error

type Note

type Note struct {
	Id       int64     `json:"id"`
	Date     time.Time `json:"date"`
	Person   *Person   `orm:"rel(fk)"  json:"-"`
	Text     string    `orm:"type(text)" json:"text"`
	Category string    `json:"category"`
}

type Person

type Person struct {
	Id    int64   `json:"id"`
	Name  string  `orm:"size(255);unique" json:"name"`
	Notes []*Note `orm:"reverse(many)" json:"-"`
	Todos []*Todo `orm:"reverse(many)" json:"-"`
}

func (*Person) LoadRelated

func (p *Person) LoadRelated(dbh *DBHandle) error

type RecurringTodo

type RecurringTodo struct {
	Id         int `json:"id"`
	Recurrance string
	Subject    string
}

type Todo

type Todo struct {
	Id       int64     `json:"id"`
	Date     time.Time `json:"date"`
	Person   *Person   `orm:"rel(fk)"  json:"-"`
	Text     string    `orm:"type(text)" json:"text"`
	Category string    `json:"category"`
}

Proably a better way of dealing with this.

Jump to

Keyboard shortcuts

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