fix(rest-storev3): use nil for start/end time

This commit is contained in:
Richard Ramos 2024-05-15 11:46:59 -04:00
parent 95968a780f
commit e59729766f
No known key found for this signature in database
GPG Key ID: 1CE87DB518195760
1 changed files with 8 additions and 6 deletions

View File

@ -95,21 +95,23 @@ func getStoreParams(r *http.Request) (store.Criteria, []store.RequestOption, err
}
startTimeStr := r.URL.Query().Get("startTime")
var startTime int64
var startTime *int64
if startTimeStr != "" {
startTime, err = strconv.ParseInt(startTimeStr, 10, 64)
startTimeValue, err := strconv.ParseInt(startTimeStr, 10, 64)
if err != nil {
return nil, nil, err
}
startTime = &startTimeValue
}
endTimeStr := r.URL.Query().Get("endTime")
var endTime int64
var endTime *int64
if endTimeStr != "" {
endTime, err = strconv.ParseInt(endTimeStr, 10, 64)
endTimeValue, err := strconv.ParseInt(endTimeStr, 10, 64)
if err != nil {
return nil, nil, err
}
endTime = &endTimeValue
}
var cursor []byte
@ -155,8 +157,8 @@ func getStoreParams(r *http.Request) (store.Criteria, []store.RequestOption, err
} else {
query = store.FilterCriteria{
ContentFilter: protocol.NewContentFilter(pubsubTopic, contentTopicsArr...),
TimeStart: &startTime,
TimeEnd: &endTime,
TimeStart: startTime,
TimeEnd: endTime,
}
}