I have struct which contains another struct.
type Message struct {
rethink.Model `structs:",flatten"`
MessageId string `json:"message_id" structs:"message_id" `
UserId string `json:"user_id" structs:"user_id"`
Body *MessageBody `json:"body" structs:"body"`
}
type Model struct {
CreatedAt rdb.Timestamp `json:"-" structs:"created_at"`
UpdatedAt rdb.Timestamp `json:"-" structs:"updated_at"`
}
Now I use a tool which turns struct into map[string]interface{}
However, in map it is with a Model key.
map[user_id:fe2ff6d1-a553-4cce-b221-74a402533317 body:map[message_type:text message:Good!!! ] Model:map[created_at:"2017-01-13T04:24:31.634Z" updated_at:"2017-01-13T04:24:31.634Z"] message_id:54e43cf0-abb0-4310-9a3f-d8b5ee452d6e]
How Can I remove the Model tag in map, just let the created_at and updated_at exist in same level as other fields.
I am using http://ift.tt/1OR2bA7
Aucun commentaire:
Enregistrer un commentaire