package Seeder import ( "git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Database" "git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Models" ) func createPost(userData Models.User) (Models.Post, error) { var ( postData Models.Post err error ) postData = Models.Post{ UserID: userData.ID, Title: "Test post", Content: "Test content", FrontPage: true, Order: 1, PostLinks: []Models.PostLink{ { Type: "Facebook", Link: "http://facebook.com/", }, }, } err = Database.CreatePost(&postData) return postData, err } func SeedPosts() { var ( userData Models.User i int err error ) err = Database.DB. Model(Models.User{}). First(&userData). Error if err != nil { panic(err) } for i = 0; i <= 20; i++ { _, err = createPost(userData) if err != nil { panic(err) } } }