Am writing a Go application on GAE
And I have a type called Connection{Token, ToAdress, FromAdress}
I want to store it in the datastore so that I can look it up via
GetConnectionByT(Token string)
But also via
GetConnectionByA(FromAdress,ToAdress string)
What is the best way of doing this? Right now my Connect type have two different .key()
functions and I insert duplicate entry's with different keys every time I add but this feels really really wrong :)
Is datastore.NewQuery("Connection").Filter
the way to go? Seames that a key should be faster and cheaper? But if not how do I filter multiple fields?