Skip to content

Commit

Permalink
SSR-2417: resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
voduchau committed Feb 21, 2023
1 parent 33651f9 commit f14b3bc
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ func (app *App) GetAllRecords(fields []string) ([]*Record, error) {
if err != nil {
return nil, err
}
r, _, err := DecodeRecords(body)
r, err := DecodeRecords(body)
if err != nil {
return nil, ErrInvalidResponse
}
Expand Down
2 changes: 0 additions & 2 deletions app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ func handleResponseGetRecords(response http.ResponseWriter, request *http.Reques
}
}

//end

func handleResponseGetRecordsComments(response http.ResponseWriter, request *http.Request) {
checkAuth(response, request)
checkContentType(response, request)
Expand Down
2 changes: 1 addition & 1 deletion cursor.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func DecodeGetRecordsCursorResponse(b []byte) (rc *GetRecordsCursorResponse, err
if err != nil {
return nil, err
}
listRecord, _, err := DecodeRecords(b)
listRecord, err := DecodeRecords(b)
if err != nil {
return nil, err
}
Expand Down
11 changes: 5 additions & 6 deletions record.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,25 +322,24 @@ func decodeRecordData(data recordData) (*Record, error) {
}

// DecodeRecords decodes JSON response for multi-get API.
func DecodeRecords(b []byte) ([]*Record, string, error) {
func DecodeRecords(b []byte) ([]*Record, error) {
var t struct {
Records []recordData `json:"records"`
TotalCount string `json:"total_count"`
Records []recordData `json:"records"`
}
err := json.Unmarshal(b, &t)
if err != nil {
return nil, "", errors.New("Invalid JSON format")
return nil, errors.New("Invalid JSON format")
}

rec_list := make([]*Record, len(t.Records))
for i, rd := range t.Records {
r, err := decodeRecordData(rd)
if err != nil {
return nil, "", err
return nil, err
}
rec_list[i] = r
}
return rec_list, t.TotalCount, nil
return rec_list, nil
}

func DecodeRecordsWithTotalCount(b []byte) ([]*Record, string, error) {
Expand Down
2 changes: 1 addition & 1 deletion record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ func TestDecodeRecords(t *testing.T) {
}
]
}`)
rec, _, err := DecodeRecords(j)
rec, err := DecodeRecords(j)
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit f14b3bc

Please sign in to comment.