diff --git a/main.go b/main.go index 70e434d..e350ef1 100644 --- a/main.go +++ b/main.go @@ -19,7 +19,7 @@ func main() { Db.Init() defer Db.Pool.Close() gin.SetMode(Config.App.Env) - Repositories.SeedMocks() + Repositories.Seed() router := gin.Default() router.LoadHTMLGlob("templates/*.html") diff --git a/repositories/mocks.go b/repositories/seeds.go similarity index 94% rename from repositories/mocks.go rename to repositories/seeds.go index 7789a0f..dce8814 100644 --- a/repositories/mocks.go +++ b/repositories/seeds.go @@ -61,7 +61,7 @@ func getPost(id int, pid *int) Post { var PostsDb = []Post{} -func seedLocalMocks() { +func seedLocal() { rand.Seed(time.Now().UnixNano()) for i := 1; i < 10; i++ { @@ -69,7 +69,7 @@ func seedLocalMocks() { } } -func seedDbMocks() { +func seedDb() { var posts []Post for i := 1; i < 10; i++ { post := getPost(i, nil) @@ -91,11 +91,11 @@ func seedDbMocks() { } } -func SeedMocks() { +func Seed() { if Db.Pool != nil { - seedDbMocks() + seedDb() } else { - seedLocalMocks() + seedLocal() } log.Println("mocks - online") }