I'm trying to build a many to many relationship, so I have 3 structs:
type Orders struct {
ID int64
CustomerID string
etc
}
type Products struct {
ID int64
Name string
Description string
etc
}
type OrderDetails struct {
OrderID int64
ProductID string
Quantity int
}
I believe this is the right way to do it, but my problem now is that I do not know how to put the datastore key inside the struct ID without making two client.Put requests because as far as I can tell, datastore.IncompleteKey("Products", nil)
will not return the new key value until after you put it..
I guess some people would recommend using key *datastore.Key
instead of ID int64
, but I would prefer to convert the key to an ID
Any help would be much appreciated