Aerospike Go client
Need to add set of common fields to all the sets ,ie CreatedAt,UpdtedAt,DeletedAt etc. For the same I have created a struct and embed that with all the set structs. I need the Fields of the common structure saved in the set as fields of the given record
type Table struct {
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt time.Time
}
type Account struct {
Table
Name string
Status bool
.....
}
For the above mentioned struct Account
.I expect the record stored with bin names
CreatedAt,UpdatedAt,DeletedAt,Name,Status.....
But when the records are stored bin names are
Table,Name,Status...
Where Table
would be a map with key values
Is it possible to achieve the expected behaviour ? if so how?
Struct embedding embeds methods and doesn't reflect attributes. Attributes of inner type are accessible thorough outer type but don't exist among attributes of outer type. So defining attribute of type Table
you literally define attribute of type Table
not reflect all attributes of type Table
to type Account
.
Try to print your Account
struct - playground.