MCPcopy Create free account
hub / github.com/dnote/dnote / getDateBounds

Function getDateBounds

pkg/server/app/notes.go:226–241  ·  view source on GitHub ↗
(year, month int)

Source from the content-addressed store, hash-verified

224}
225
226func 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
243func orderGetNotes(conn *gorm.DB) *gorm.DB {
244 return conn.Order("notes.updated_at DESC, notes.id DESC")

Callers 1

getNotesBaseQueryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected