| 224 | } |
| 225 | |
| 226 | func getDateBounds(year, month int) (int64, int64) { |
| 227 | var yearUpperbound, monthUpperbound int |
| 228 | |
| 229 | if month == 12 { |
| 230 | monthUpperbound = 1 |
| 231 | yearUpperbound = year + 1 |
| 232 | } else { |
| 233 | monthUpperbound = month + 1 |
| 234 | yearUpperbound = year |
| 235 | } |
| 236 | |
| 237 | lower := time.Date(year, time.Month(month), 1, 0, 0, 0, 0, time.UTC).UnixNano() |
| 238 | upper := time.Date(yearUpperbound, time.Month(monthUpperbound), 1, 0, 0, 0, 0, time.UTC).UnixNano() |
| 239 | |
| 240 | return lower, upper |
| 241 | } |
| 242 | |
| 243 | func orderGetNotes(conn *gorm.DB) *gorm.DB { |
| 244 | return conn.Order("notes.updated_at DESC, notes.id DESC") |