mirror of
https://github.com/injoyai/tdx.git
synced 2025-11-26 21:25:35 +08:00
测试通过
This commit is contained in:
6
codes.go
6
codes.go
@@ -7,6 +7,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
"xorm.io/core"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
@@ -21,6 +22,7 @@ func NewCodes(c *Client, filename string) (*Codes, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
db.SetMapper(core.SameMapper{})
|
||||
db.DB().SetMaxOpenConns(1)
|
||||
if err := db.Sync2(new(CodeModel)); err != nil {
|
||||
return nil, err
|
||||
@@ -166,6 +168,10 @@ type CodeModel struct {
|
||||
InDate int64 `json:"inDate" xorm:"created"` //创建时间
|
||||
}
|
||||
|
||||
func (c *CodeModel) TableName() string {
|
||||
return "codes"
|
||||
}
|
||||
|
||||
func NewSessionFunc(db *xorm.Engine, fn func(session *xorm.Session) error) error {
|
||||
session := db.NewSession()
|
||||
defer session.Close()
|
||||
|
||||
Reference in New Issue
Block a user