|
|
@ -1,29 +1,7 @@ |
|
|
|
package modelgen |
|
|
|
|
|
|
|
import ( |
|
|
|
"git.ouxuan.net/hasaki-service/hasaki-sdk/hskdb" |
|
|
|
"time" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
|
type Model struct { |
|
|
|
Id int `json:"id"` |
|
|
|
CreatedAt time.Time `json:"created_at"` |
|
|
|
UpdatedAt time.Time `json:"updated_at"` |
|
|
|
DeletedAt time.Time `json:"deleted_at"` |
|
|
|
} |
|
|
|
// 生成model
|
|
|
|
func Gen() { |
|
|
|
|
|
|
|
type Context struct { |
|
|
|
session *xorm.Session |
|
|
|
instance interface{} |
|
|
|
} |
|
|
|
|
|
|
|
type UserModel struct { |
|
|
|
} |
|
|
|
|
|
|
|
func (u *UserModel) Objects() *Context { |
|
|
|
return &Context{ |
|
|
|
session: hskdb.GetXormAuto().NewSession(), |
|
|
|
instance: u, |
|
|
|
} |
|
|
|
} |
|
|
|
} |