Rename BaseTable to BaseModel
This commit is contained in:
parent
bb9a5789d7
commit
7b32887840
@ -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
|
||||
}
|
||||
|
||||
|
@ -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")
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user