From 25a70aff86aee11c8ede8ea6a0f73d5954732825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Thu, 11 Aug 2022 15:29:14 +0800 Subject: [PATCH] =?UTF-8?q?enhance(model):=E5=8A=A0=E5=85=A5=E8=A1=8C?= =?UTF-8?q?=E6=94=BF=E5=8C=BA=E5=88=92=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 1 + model/region.go | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 model/region.go diff --git a/main.go b/main.go index 0cbe3cd..da732d7 100644 --- a/main.go +++ b/main.go @@ -26,6 +26,7 @@ func init() { log.Println("Main Database connected!") err = global.DBConn.Sync( + &model.Region{}, &model.User{}, &model.UserDetail{}, &model.UserCharge{}, diff --git a/model/region.go b/model/region.go new file mode 100644 index 0000000..a11d44c --- /dev/null +++ b/model/region.go @@ -0,0 +1,12 @@ +package model + +type Region struct { + Code string `xorm:"varchar(15) pk not null" json:"code"` + Name string `xorm:"varchar(50) not null" json:"name"` + Level int8 `xorm:"smallint not null default 0" json:"level"` + Parent string `xorm:"varchar(15) not null default '0'" json:"parent"` +} + +func (Region) TableName() string { + return "region" +}