controller

package
v0.0.0-...-d1ca7b6 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(w http.ResponseWriter, err error, code int)

func JSON

func JSON(w http.ResponseWriter, code int, data interface{}) error

func TXHandler

func TXHandler(db *sqlx.DB, f func(*sqlx.Tx) error) error

TXHandler is handler for working with transaction. This is wrapper function for commit and rollback.

Types

type H

type H map[string]interface{}

type Todo

type Todo struct {
	DB *sqlx.DB
}

Todo はTodoへのリクエストに関する制御をします

func (*Todo) Delete

func (t *Todo) Delete(w http.ResponseWriter, r *http.Request) error

func (*Todo) Get

func (t *Todo) Get(w http.ResponseWriter, r *http.Request) error

GetはDBからユーザを取得して結果を返します

func (*Todo) Post

func (t *Todo) Post(w http.ResponseWriter, r *http.Request) error

PostはタスクをDBに追加します todoをJSONとして受け取ることを想定しています。

func (*Todo) Put

func (t *Todo) Put(w http.ResponseWriter, r *http.Request) error

func (*Todo) Toggle

func (t *Todo) Toggle(w http.ResponseWriter, r *http.Request) error

Jump to

Keyboard shortcuts

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