Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get JSON from MySql? #81

Open
kolkov opened this issue Sep 19, 2019 · 0 comments
Open

How to get JSON from MySql? #81

kolkov opened this issue Sep 19, 2019 · 0 comments

Comments

@kolkov
Copy link
Contributor

kolkov commented Sep 19, 2019

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant