Rename BaseTable to BaseModel

This commit is contained in:
Nicolas Duhamel 2016-02-20 19:42:56 +01:00
parent bb9a5789d7
commit 7b32887840
3 changed files with 8 additions and 7 deletions

View File

@ -42,12 +42,12 @@ const (
)
var (
// NotFound error returned when show not found in database
// ErrNotFound error returned when show not found in database
ErrNotFound = fmt.Errorf("Not found")
)
type Show struct {
sqly.BaseTable
sqly.BaseModel
polochon.Show
Episodes []*Episode
TrackedSeason int
@ -213,7 +213,7 @@ func (s *Show) GetEpisodes(db *sqlx.DB) error {
}
type Episode struct {
sqly.BaseTable
sqly.BaseModel
polochon.ShowEpisode
}

View File

@ -9,13 +9,14 @@ import (
"github.com/mattes/migrate/migrate"
)
// BaseTable have to be embeded in all your struct which reflect a table
type BaseTable struct {
// BaseModel have to be embeded in all your struct which reflect a table
type BaseModel struct {
ID string
Updated time.Time
Created time.Time
}
// RunWithLastestMigration runs your test with database migration set to the lastest
func RunWithLastestMigration(db *sqlx.DB, pgdsn string, t *testing.T, test func(db *sqlx.DB, t *testing.T)) {
defer func() {
allErrors, ok := migrate.DownSync(pgdsn, "../sql")

View File

@ -22,14 +22,14 @@ const (
// User represents an user
type User struct {
sqly.BaseTable
sqly.BaseModel
Name string
Hash string
}
// Token represents a token
type Token struct {
sqly.BaseTable
sqly.BaseModel
Value string
}