I just started using Datastore, so I'm still not sure about few things.
I have the fallowing entities:
Property:
{ID, number, name, long, lat}
Address:
{name, postCodeType}
City:
{name}
Country:
{name}
User:
{name, username}
So the logic behind this is that a User
will have multiple properties
, which means that a property
will hold a user key
.
As described above the Property
has some properties, but I am not sure on how to associate the address
city
and country
.
I think a solution will be to store the keys for those 3 entities in the property entity
.
type Property struct {
ID int64 `json:"id" datastore:"-"`
Number int8 `json:"number"`
Name string `json:"name"`
Long float64 `json:"long"`
Lat float64 `json:"lat"`
AddressKey *datastore.Key
CityKey *datastore.Key
CountryKey *datastore.Key
UserKey *datastore.Key
CreatedAt time.Time
}
Is my attempt from above a good start or what do I need to do different.