mirror of
https://github.com/yanislav-igonin/micrach
synced 2024-12-22 14:22:33 +03:00
feat: rename
This commit is contained in:
parent
a70413ceb3
commit
0e46965130
2
main.go
2
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")
|
||||
|
@ -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")
|
||||
}
|
Loading…
Reference in New Issue
Block a user