# README
Tile38 Client for Go
See what Tile38 is all about.
Installation
go get github.com/xjem/t38c@latest
Basic example
package main
import (
"fmt"
"github.com/xjem/t38c"
)
func main() {
tile38, err := t38c.New(t38c.Config{
Address: "localhost:9851",
Debug: true, // print queries to stdout
})
if err != nil {
panic(err)
}
defer client.Close()
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).
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(context.TODO())
if err != nil {
panic(err)
}
// truck1 {33.5123 -112.2693}
fmt.Println(response.Points[0].ID, response.Points[0].Point)
}
# Functions
New creates a new Tile38 client.
NewWithExecutor creates a new Tile38 client with provided executor.
# Constants
Cross is when an object that was not previously in the fence has entered and exited the area.
Del notifies the client that an object has been deleted from the collection that is being fenced.
Drop notifies the client that the entire collection is dropped.
Enter is when an object that was not previously in the fence has entered the area.
Exit is when an object that was previously in the fence has exited the area.
Inside is when an object is inside the specified area.
Outside is when an object is outside the specified area.
Set notifies the client that an object has been added or updated, and when it’s position is detected by the fence.
# Variables
FormatBounds - A list of minimum bounding rectangle.
FormatCount - Total object count sent in the response.
FormatHashes - A list of Geohash.
FormatIDs - A list of IDs belonging to the key.
FormatPoints - A list of standard latitude, longitude points.
# Structs
Bounds is a tile38 bounds object.
Chan represents tile38 channel.
Channels struct.
Client allows you to interact with the Tile38 server.
Config is a t38c client config.
FSetQueryBuilder struct.
Geofence struct.
GeofenceAreaSelector struct.
GeofenceEvent is a tile38 geofence event.
GeofenceQueryBuilder optional params.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Hook represents tile38 channel.
Hooks struct.
InwAreaSelector struct Intersects Nearby Within.
InwQueryBuilder struct Intersects Nearby Within.
JSetQueryBuilder struct.
Keys struct.
No description provided by the author
KeyStats is a tile38 key stats.
Meta is tile38 metadata.
Object is a tile38 object.
Point is a tile38 point.
RoamObject is a tile38 roam object.
ScanQueryBuilder struct.
Scripting struct.
Search struct.
SearchQueryBuilder struct.
SearchResponse is a tile38 search response.
No description provided by the author
SetAreaSelector struct.
SetChannelQueryBuilder struct.
SetHookQueryBuilder struct.
SetQueryBuilder struct.
# Type aliases
DetectAction ...
EventHandlerFunc is an adapter to allow the use of ordinary functions as tile38 event handlers.
NotifyCommand ...
OutputFormat specifies expected format.