aerospike-client-go
aerospike-client-go copied to clipboard
add inline annotation
In mgo's driver they have an inline
annotation (http://bazaar.launchpad.net/+branch/mgo/v2/view/head:/bson/bson.go#L442)
I propose this is added. The issue is otherwise an added structure is treated like a json object and you can't add a second query to any of it.
Thanks for your suggestion. Will look into it.
So you're proposing that:
type Foo struct {
FooA int
FooB Bar `aerospike:",inline"`
FooC string `aerospike:"ccc"`
}
type Bar struct {
A int
B string
}
Results in the bins:
-
FooA
-
FooB.A
-
FooB.B
-
ccc
That does sound interesting!
Or could also become the bins:
-
FooA
-
A
-
B
-
ccc
But I like that less. It will cause a conflict when a field named A
is added to the Foo
struct.
It's the latter, and that's why this issue is on the back burner.
I'd like to +1 on the issue.
Current API seems a bit wasteful in 100% of our cases: the aerospike-client returns BinMap
s, that're map[string]interface{}
, and we convert them into strictly typed objects.
As an example, being able to pass a zero-value struct that implements, a hypothetical BinSerDer
, to read-methods, will reduce the number of temporal allocations.
@narqo I'm working on a solution along those lines, but with a dash of code generation. Does that sound good to you?