Build Table Queries
The TzPro Table API is the fastest way to ingest and process on-chain data in bulk. The SDK defines typed query objects for most tables and allows you to add filter conditions and other configuration to these queries.
import (
"context"
"github.com/trilitech/tzpro-go/tzpro"
)
client := tzpro.DefaultClient
ctx := context.Background()
// create a new query object
q := client.NewBigmapValueQuery()
// add filters and configure the query to list all active keys
q.WithFilter(tzpro.FilterModeEqual, "bigmap_id", 514).
WithColumns("row_id", "key_hash", "key", "value").
WithLimit(1000).
WithOrder(tzpro.OrderDesc)
// execute the query
list, err := q.Run(ctx)
// walk rows
for _, row := range list.Rows {
// process data here
}
// you have reached the end of the result set when list.Len() == 0