ozzo-dbx
ozzo-dbx copied to clipboard
How to get JSON from MySql?
Hi! How can I get json from MySql to my model struct? Is this possible?
type Cargo struct {
Id int64 `json:"id"`
CompanyId int64 `json:"companyId"`
ShipperId int64 `json:"shipperId"`
ConsigneeId int64 `json:"consigneeId"`
ConsigneeContacts ConsigneeContacts `json:"consigneeContacts"`
Type int
ShippingName string `json:"shippingName"`
ReceiptNumber int `json:"receiptNumber"`
IncomingDate null.Time `json:"incomingDate"`
PackagesNumber int `json:"packagesNumber"`
Volume float64 `json:"volume"`
Weight float32 `json:"weight"`
Status string `json:"status"`
WaggonObservedId int `json:"waggonObservedId"`
Note string `json:"'note'"`
CreatorId int `json:"creatorId"`
CreatedAt null.Time `json:"createdAt"`
}
type ConsigneeContacts struct {
Phones []string `json:"phones"`
Emails []string `json:"emails"`
}
{"emails": ["[email protected]"], "phones": ["9161234567"]}
Thanks!