Browse Source

bug: fix

master
小黄 4 years ago
parent
commit
847fc09535
  1. 9
      README.md
  2. 2
      go.mod
  3. 2
      main.go
  4. 28
      modelgen/gen.go

9
README.md

@ -1,3 +1,10 @@
# hasaki-ctl
工具
工具
servicegen
modelgen
ui
可以通过某些request/response/handler 确定简单的接口。

2
go.mod

@ -1,4 +1,4 @@
module demo
module hasaki-ctl
go 1.14

2
main.go

@ -1,7 +1,7 @@
package main
import (
"demo/servicegen"
"hasaki-ctl/servicegen"
"github.com/spf13/cobra"
)

28
modelgen/gen.go

@ -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,
}
}
}
Loading…
Cancel
Save