Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
docs: update README example to new context api
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowspore committed Nov 14, 2022
1 parent f1c6d16 commit ce9b1d8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ See what [Tile38](https://tile38.com/) is all about.
### Installation

```
go get github.com/xjem/t38c
go get github.com/xjem/t38c@latest
```

### Basic example
Expand All @@ -34,23 +34,23 @@ func main() {
}
defer client.Close()

if err := client.Keys.Set("fleet", "truck1").Point(33.5123, -112.2693).Do(); err != nil {
if err := client.Keys.Set("fleet", "truck1").Point(33.5123, -112.2693).Do(context.TODO()); err != nil {
panic(err)
}

if err := client.Keys.Set("fleet", "truck2").Point(33.4626, -112.1695).
// optional params
Field("speed", 20).
Expiration(20).
Do(); err != nil {
Field("speed", 20). // optional
Expiration(20). // optional
Do(context.TODO()); err != nil {
panic(err)
}

// search 6 kilometers around a point. returns one truck.
response, err := client.Search.Nearby("fleet", 33.462, -112.268, 6000).
Where("speed", 0, 100).
Match("truck*").
Format(t38c.FormatPoints).Do()
Format(t38c.FormatPoints).
Do(context.TODO())
if err != nil {
panic(err)
}
Expand Down

0 comments on commit ce9b1d8

Please sign in to comment.