package models
import (
"encoding/json"
"time"
"github.com/gobuffalo/pop"
"github.com/gobuffalo/validate"
"github.com/gofrs/uuid"
)
// Test is used by pop to map your .model.Name.Proper.Pluralize.Underscore database table to your go code.
type Test struct {
ID uuid.UUID `json:"id" db:"id"`
Messsage string `json:"messsage" db:"messsage"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
}
// ★★★ここでテーブル名を指定することが出来ます。
func (t Test) TableName() string {
return "testTest"
}
// String is not required by pop and may be deleted
func (t Test) String() string {
jt, _ := json.Marshal(t)
return string(jt)
}
// Tests is not required by pop and may be deleted
type Tests []Test
// String is not required by pop and may be deleted
func (t Tests) String() string {
jt, _ := json.Marshal(t)
return string(jt)
}
// Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method.
// This method is not required and may be deleted.
func (t *Test) Validate(tx *pop.Connection) (*validate.Errors, error) {
return validate.NewErrors(), nil
}
// ValidateCreate gets run every time you call "pop.ValidateAndCreate" method.
// This method is not required and may be deleted.
func (t *Test) ValidateCreate(tx *pop.Connection) (*validate.Errors, error) {
return validate.NewErrors(), nil
}
// ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method.
// This method is not required and may be deleted.
func (t *Test) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {
return validate.NewErrors(), nil
}