shadowspore / t38c Goto Github PK
View Code? Open in Web Editor NEWTile38 Client package
License: MIT License
Tile38 Client package
License: MIT License
Hello,
I ran into an with setting a field with a very large value using FSet
resulting in an incorrect value set in Tile38. The issue appears to be caused by the rounding configured in the floatString
function. I suspect a fix might be as simple as updating the formatFloat
function to be something like this instead.
func formatFloat(v float64) string {
return strconv.FormatFloat(v, 'f', 0, 64)
}
An example of a failure case:
_ = client.Keys.JSet("test", "example", "key", "value").Do()
_ = client.Keys.FSet("test", "example").Field("id", 123456789012345680).Do()
The code will result in example
having a field id
set to 123456789000000000
instead of the expected value 123456789012345680
. However, manually setting the field in the cli does give the expected results. This can be sen in the Tile38 cli:
127.0.0.1:9851> GET test example WITHFIELDS
{"ok":true,"object":"{\"key\":\"value\"}","fields":{"id":123456789000000000},"elapsed":"19.377µs"}
127.0.0.1:9851> FSET test example id 123456789012345680
{"ok":true,"elapsed":"9.808µs"}
127.0.0.1:9851> GET test example WITHFIELDS
{"ok":true,"object":"{\"key\":\"value\"}","fields":{"id":123456789012345680},"elapsed":"20.699µs"}
I can create a PR if needed; let me know if I should do anything besides adding a test case to TestKeys
.
Radix v4 supports passing a context.Context
to all blocking operations.
We require this feature to limit potential request timeouts.
Please update t38c so that the Execute
method and other command methods can take advantage of this feature.
Hi,
I'm trying to retrieve a point in the Point output format. To do so, I tried to force a bit the Keys.Get without success, I found a way around but I am under the impression that this is not a good solution.
Tile.Keys.Set("fleet", "truck1").Point(61.76543034, 37.67770367).Do()
// ==> [SET fleet truck1 POINT 61.76543034 37.67770367]: {"ok":true,"elapsed":"775.125µs"}
// This Fail
q, err := Tile.Keys.Get("fleet", "truck1"+" POINT", false)
// ==> [GET fleet truck1 POINT]: {"ok":false,"err":"id not found","elapsed":"35.208µs"}
// This works
q, err := Tile.Execute("GET", "fleet", "truck1", "POINT")
// ==> [GET fleet truck1 POINT]: {"ok":true,"point":{"lat":61.76543034,"lon":37.67770367},"elapsed":"373.291µs"}
resp := t38c.GetResponse{}
json.Unmarshal(q, &resp)
I can't get to understand why it failed when the two commands look exactly the same.
Hello,
I have noticed a typo in t38c/scan_query_builder.go line 45 on "Cursor"
Thanks for the great work!
As in the docs?
Does t38c support newer area formats such as sector for within/intersects
Hi, thanks for this library. Is this possible to document the "roam" method for the geofence ?
The function signature is the following:
func (gf *Geofence) Roam(key, target, pattern string, meters int) GeofenceQueryBuilder
It is unclear to me if "pattern" corresponds to the pattern of the target collection, or of the key collection.
Is it possible to extend this query with a further "match" ?
Moreover, how to set/unset the "nodwell" keywork for this query?
After setting an object's expiration, calling TTL on the object causes an error:
json: cannot unmarshal number 0.174668 into Go struct field .ttl of type int
Calling TTL directly on the tile38-cli, looks like tile38 returns a float (instead of an int)
{"ok":true,"ttl":0.174668,"elapsed":"7.359µs"}
should be a super quick fix, something like this:
func (ks *Keys) TTL(key, objectID string) (float64, error) {
var resp struct {
TTL float64 `json:"ttl"`
}
err := ks.client.jExecute(&resp, "TTL", key, objectID)
if err != nil {
return -1, err
}
return resp.TTL, nil
}
Within.Get
is incorrectly typed: according to the documentation it should build a query like WITHIN key1 GET key2 id
, but the Get
function only accepts one parameter objectID
. All Within.Get
queries fail with invalid number of arguments
.
It feels a Nearby() request can only be formated as t38c.FormatPoints
.
My data is a GeoJson feature like:
NEARBY restos POINT 37.400900 -79.178500 6000
{"ok":true,"objects":[{"id":"node/5807785416","object":{"type":"Feature","geometry":{"type":"Point","coordinates":[-79.2233665,37.3977684]},"id":"node/5807785416","properties":{"@id":"node/5807785416","amenity":"fast_food","brand":"Chipotle","brand:wikidata":"Q465751","brand:wikipedia":"en:Chipotle Mexican Grill","cuisine":"mexican","diet:vegan":"yes","diet:vegetarian":"yes","name":"Chipotle","official_name":"Chipotle Mexican Grill","opening_hours":"Mo-Su 10:45-22:00","outdoor_seating":"yes","takeaway":"yes","toilets:access":"customers"}}}],"count":1,"cursor":0,"elapsed":"211.209µs"}
So how can I do to use the other fields like brand
out of a command like
response, err := db.Search.Nearby("restos", lat, lon, 60000).
Format(t38c.FormatPoints). <----------------------------------------
Do(context.TODO())
Thanks.
The function Field(name string, value float64)
in the builders take a value as a float64
. This makes the function not support strings, boolean and JSON. However, when building the command, the float64
is converts to a string using floatString(val float64) string
. Should it then just take a string as a value like so Field(name string, value string)
thus allowing for support of the missing types?
I use this for creating a point and mongodb. everything runs great. But now im testing and im unsure how to hit the keys.set.... part of the function. any pointers or examples would be fantastic
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.