Skip to content

Commit c8917dd

Browse files
authored
Merge pull request #62 from csfloat/fix/decode-string
decode to string instead of uint
2 parents 64c0fcb + 2db8a0c commit c8917dd

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

ingestors/csfloat/csfloat.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"hash/fnv"
88
"net/http"
9+
"strconv"
910
"time"
1011

1112
"reverse-watch/config"
@@ -54,7 +55,7 @@ type slimWarning struct {
5455

5556
type responseData struct {
5657
Data []*slimWarning `json:"data"`
57-
NextCursor *uint `json:"next_cursor"`
58+
NextCursor *string `json:"next_cursor"`
5859
}
5960

6061
type errorResponse struct {
@@ -102,7 +103,16 @@ func (i *csfloatIngestor) fetch(ctx context.Context, cursor *uint) ([]*slimWarni
102103
return nil, nil, errors.New(errors.JSONDecode, err.Error())
103104
}
104105

105-
return data.Data, data.NextCursor, nil
106+
var nextCursor *uint
107+
if data.NextCursor != nil {
108+
next, err := strconv.ParseUint(*data.NextCursor, 10, 64)
109+
if err != nil {
110+
return nil, nil, errors.New(errors.JSONDecode, err.Error())
111+
}
112+
nextCursor = util.Ptr(uint(next))
113+
}
114+
115+
return data.Data, nextCursor, nil
106116
}
107117

108118
// process warnings and create reversals, returns the most recent reversal

0 commit comments

Comments
 (0)