Skip to content

Commit

Permalink
fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmalkmus committed Sep 17, 2024
1 parent 16108ef commit d880ac0
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions examples/query/main_go122.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"os"

"github.com/axiomhq/axiom-go/axiom"
"github.com/axiomhq/axiom-go/axiom/query"
)

func main() {
Expand Down Expand Up @@ -39,14 +38,11 @@ func main() {
log.Fatal("No matches found")
}

// 3. Print the queried results by creating a iterator for the rows from the
// tabular query result (as it is organized in columns) and iterating over
// the rows.
rows := res.Tables[0].Rows()
if err := rows.Range(ctx, func(_ context.Context, row query.Row) error {
_, err := fmt.Println(row)
return err
}); err != nil {
log.Fatal(err)
// 3. Print the queried results by iterating through each column with the
// same row index.
for i := range len(res.Tables[0].Columns[0]) {
for j := range res.Tables[0].Columns {
fmt.Println(res.Tables[0].Columns[j][i])
}
}
}

0 comments on commit d880ac0

Please sign in to comment.