city.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package entity
  2. import "gopkg.in/guregu/null.v3"
  3. type City struct {
  4. Id int `db:"id"`
  5. Name string `db:"name"`
  6. AreaCode string `db:"area_code"`
  7. IsOpen int `db:"is_open"`
  8. Countys []County `db:"-"`
  9. }
  10. type County struct {
  11. Id int `db:"id" json:"id"`
  12. CityId int `db:"city_id" json:"city_id"`
  13. Name string `db:"name" json:"name"`
  14. PostCode string `db:"post_code" json:"post_code"`
  15. }
  16. type City2 struct {
  17. Id int `db:"id"`
  18. Name string `db:"name"`
  19. Counties []County2 `db:"-" json:"children"`
  20. }
  21. type CityNode struct {
  22. Id int `db:"id" json:"id"`
  23. Name string `db:"name" json:"name"`
  24. PId int `db:"province_id" json:"pid"`
  25. PName null.String `db:"province" json:"pname"`
  26. Counties []CountyNode `db:"-" json:"children"`
  27. }
  28. type CountyNode struct {
  29. Id int `db:"id" json:"id"`
  30. Name string `db:"name" json:"name"`
  31. PId int `db:"_" json:"pid"`
  32. PName null.String `db:"_" json:"pname"`
  33. }
  34. type County2 struct {
  35. Id int `db:"id" json:"id"`
  36. Name string `db:"name" json:"name"`
  37. }
  38. type Province struct {
  39. Id int `db:"id"`
  40. Name string `db:"name"`
  41. Cities []City2 `db:"-" json:"children"`
  42. }
  43. type CityAll struct {
  44. ProvinceId int `db:"province_id"`
  45. Province string `db:"province"`
  46. CityId int `db:"city_id"`
  47. City string `db:"city"`
  48. CountryId int `db:"country_id"`
  49. Country string `db:"country"`
  50. }