repository

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDbConnection

func InitDbConnection(dbConfPath string, test bool) (err error)

func Migrate

func Migrate(dbConfPath string, migrationPath string, test bool) (errors []error)

func Rollback

func Rollback(dbConfPath string, migrationPath string, test bool) (errors []error)

Types

type DbConf

type DbConf struct {
	Db     DbParams `json:"db"`
	TestDb DbParams `json:"test_db"`
}

type DbParams

type DbParams struct {
	Host string `json:"host"`
	Port string `json:"port"`
	User string `json:"user"`
	Pass string `json:"pass"`
	Name string `json:"name"`
}

type Todo

type Todo struct {
	Id        int    `json:"id"`
	Title     string `json:"title"`
	Body      string `json:"body"`
	UserId    int
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func GetTodo

func GetTodo(id int) (todo Todo, err error)

func GetTodoList

func GetTodoList() (todos []Todo, err error)

func GetTodoListFilteredByUserId

func GetTodoListFilteredByUserId(userId int) (todos []Todo, err error)

func (*Todo) Create

func (todo *Todo) Create() (err error)

func (*Todo) Delete

func (todo *Todo) Delete() (err error)

func (*Todo) Update

func (todo *Todo) Update() (err error)

type User

type User struct {
	Id        int       `json:"id"`
	Name      string    `json:"name"`
	Email     string    `json:"email"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func AuthenticateUser

func AuthenticateUser(username string, password string) (user User, ok bool)

func GetUser

func GetUser(id int) (user User, err error)

func GetUserList

func GetUserList() (users []User, err error)

func (*User) Create

func (user *User) Create(password string) (err error)

func (*User) Delete

func (user *User) Delete() (err error)

func (*User) Update

func (user *User) Update() (err error)

Jump to

Keyboard shortcuts

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