64 return posts, err
65}
66
67func createPostsQuery(lastId int64, productId int64, field string) string { 68 var query string
69 if field != "" {
70 if lastId == 0 {
49 *gorm.DB
50}
51
52func (db *DBConn) GetPosts(field string, productId int64, lastId int64, preloadUser bool) ([]Post, error) { 53 var posts []Post
54 var err error
55 query := createPostsQuery(lastId, productId, field)
If parameters of the same type lie consecutively, mention their type once at the end of the last parameter.
Unlike other languages, like C, where all parameters must be specified with types explicitly, it is not required to do so in Go. Combining the types is usually recommended for the sake of brevity.
func foo(a, b int, c, d int, e, f int, g int) {}
func foo(a, b, c, d, e, f, g int) {}