package orderrequestlogmodel
import (
"github.com/qit-team/snow-core/db"
"sync"
"time"
)
var (
once sync.Once
m *OrderRequestLogModel
)
// 实体
type OrderRequestLog struct {
Id int64
IpAddress string `xorm:"'ip_address' varchar(16)"`
OrderId int64 `xorm:"'order_id' bigint(20)"`
MerchantRequest string `xorm:"'merchant_request' JSON"`
MerchantResponse string `xorm:"'merchant_response' JSON"`
CreateTime time.Time `xorm:"'create_time' datetime created"`
UpdateTime time.Time `xorm:"'update_time' timestamp updated"`
Status int `xorm:"'status' TINYINT"`
}
// 表名
func (m *OrderRequestLog) TableName() string {
return "order_request_log"
}
// 私有化,防止被外部new
type OrderRequestLogModel struct {
db.Model //组合基础Model,集成基础Model的属性和方法
}
// 单例模式
func GetInstance() *OrderRequestLogModel {
once.Do(func() {
m = new(OrderRequestLogModel)
//m.DiName = "" //设置数据库实例连接,默认db.SingletonMain
})
return m
}