Skip to content

Commit

Permalink
Use correct JSON field names in BlockchainIngestResponse (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
vegarsti authored Jun 20, 2024
1 parent 99f947b commit f776e08
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions client/duneapi/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package duneapi
import (
"fmt"
"sort"
"strings"

"github.com/duneanalytics/blockchain-ingester/models"
)
Expand All @@ -27,16 +28,24 @@ type BlockchainIngestResponse struct {
}

type IngestedTableInfo struct {
Name string `json:"name"`
Rows int `json:"rows_written"`
Bytes int `json:"bytes_written"`
Name string `json:"name"`
Rows int `json:"rows"`
}

func (b *BlockchainIngestResponse) String() string {
sort.Slice(b.Tables, func(i, j int) bool {
return b.Tables[i].Name < b.Tables[j].Name
})
return fmt.Sprintf("%+v", b.Tables)
s := strings.Builder{}
s.WriteString("[")
for i, t := range b.Tables {
if i > 0 {
s.WriteString(", ")
}
s.WriteString(fmt.Sprintf("%s: %d", t.Name, t.Rows))
}
s.WriteString("]")
return s.String()
}

type BlockchainIngestRequest struct {
Expand Down

0 comments on commit f776e08

Please sign in to comment.