feat: rename

This commit is contained in:
Yanislav Igonin 2021-09-01 15:48:39 +03:00
parent a70413ceb3
commit 0e46965130
2 changed files with 6 additions and 6 deletions

View File

@ -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")

View File

@ -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")
}