(conn *gorm.DB, page, perPage int)
| 245 | } |
| 246 | |
| 247 | func paginate(conn *gorm.DB, page, perPage int) *gorm.DB { |
| 248 | // Paginate |
| 249 | if page > 0 { |
| 250 | offset := perPage * (page - 1) |
| 251 | conn = conn.Offset(offset) |
| 252 | } |
| 253 | |
| 254 | conn = conn.Limit(perPage) |
| 255 | |
| 256 | return conn |
| 257 | } |
| 258 | |
| 259 | // GetNotesResult is the result of getting notes |
| 260 | type GetNotesResult struct { |