PaymentCenter/app/models/merchantmodel/merchant.go

45 lines
1023 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package merchantmodel
import (
"github.com/qit-team/snow-core/db"
"sync"
"time"
)
var (
once sync.Once
m *MerchantModel
)
// 实体
type Merchant struct {
Id int64
Name string `xorm:"'name' varchar(128)"`
Contact string `xorm:"'contact' varchar(128)"`
Phone string `xorm:"'phone' varchar(11)"`
Remark string `xorm:"'remark' varchar(1024)"`
CreateTime time.Time `xorm:"'create_time' datetime created"`
UpdateTime time.Time `xorm:"'update_time' timestamp updated"`
DeleteTime time.Time `xorm:"'delete_time' timestamp deleted"`
Creator int `xorm:"'creator' int(11)"`
}
// 表名
func (m *Merchant) TableName() string {
return "merchant"
}
// 私有化防止被外部new
type MerchantModel struct {
db.Model //组合基础Model集成基础Model的属性和方法
}
// 单例模式
func GetInstance() *MerchantModel {
once.Do(func() {
m = new(MerchantModel)
//m.DiName = "" //设置数据库实例连接默认db.SingletonMain
})
return m
}