model

package
v0.0.0-...-f92da8c Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2016 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Api

func Api() *rest.Api

Types

type Item

type Item struct {
	ID         int64      `json:"id"          gorm:"primary_key"`
	CreatedAt  time.Time  `json:"createdAt"`
	UpdatedAt  time.Time  `json:"updatedAt"`
	DeletedAt  *time.Time `json:"-"           sql:"index"`
	QuestionID int64      `json:"questionId"  gorm:"index"`
	Title      string     `json:"title"       gorm:"type:varchar(140)"`
}

func (*Item) BeforeCreate

func (i *Item) BeforeCreate(scope *gorm.Scope) error

type Question

type Question struct {
	ID              int64      `json:"id"              gorm:"primary_key"`
	CreatedAt       time.Time  `json:"createdAt"`
	UpdatedAt       time.Time  `json:"updatedAt"`
	DeletedAt       *time.Time `json:"-"               sql:"index"`
	Title           string     `json:"title"           gorm:"type:varchar(255)"`
	CompareQuestion string     `json:"compareQuestion" gorm:"type:varchar(255)"`
	Items           []Item     `json:"items"`
	Votes           []Vote     `json:"votes"`
}

func (*Question) BeforeCreate

func (q *Question) BeforeCreate(scope *gorm.Scope) error

type RestFuncs

type RestFuncs struct{}

func (*RestFuncs) GetQuestion

func (rf *RestFuncs) GetQuestion(w rest.ResponseWriter, r *rest.Request)

func (*RestFuncs) PostQuestion

func (rf *RestFuncs) PostQuestion(w rest.ResponseWriter, r *rest.Request)

func (*RestFuncs) Vote

func (rf *RestFuncs) Vote(w rest.ResponseWriter, r *rest.Request)

type Vote

type Vote struct {
	ID           int64      `json:"id"            gorm:"primary_key"`
	CreatedAt    time.Time  `json:"createdAt"`
	UpdatedAt    time.Time  `json:"updatedAt"`
	DeletedAt    *time.Time `json:"-"             sql:"index"`
	QuestionID   int64      `json:"questionId"  gorm:"index"`
	OrderedItems string     `json:"orderedItems"  gorm:"type:varchar(500)"`
}

func (*Vote) BeforeCreate

func (v *Vote) BeforeCreate(scope *gorm.Scope) error

Jump to

Keyboard shortcuts

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