public_host 4 years ago
parent
commit
4f56b738dc
  1. 6
      hasaki-gen-crud/hasaki-gen-crud.js
  2. 17
      test.go

6
hasaki-gen-crud/hasaki-gen-crud.js

@ -149,19 +149,19 @@ try {
fs.writeFile(crudFileName, `${package_src}\n\n${tmp[2]}`, function () { fs.writeFile(crudFileName, `${package_src}\n\n${tmp[2]}`, function () {
cp.exec(`gopls fix -a -w ${crudFileName}`, function (a, b, c) { cp.exec(`gopls fix -a -w ${crudFileName}`, function (a, b, c) {
console.log(a, b, c)
console.log("exec:", a, b, c)
}) })
}) })
fs.writeFile(httpFileName, `${package_src}\n\n${tmp[3]}`, function () { fs.writeFile(httpFileName, `${package_src}\n\n${tmp[3]}`, function () {
cp.exec(`gopls fix -a -w ${httpFileName}`, function (a, b, c) { cp.exec(`gopls fix -a -w ${httpFileName}`, function (a, b, c) {
console.log(a, b, c)
console.log("exec:", a, b, c)
}) })
}) })
cp.exec(`gopls fix -a -w ${fileName}`, function (a, b, c) { cp.exec(`gopls fix -a -w ${fileName}`, function (a, b, c) {
console.log(a, b, c)
console.log("exec:", a, b, c)
}) })

17
test.go

@ -3,27 +3,10 @@
*/ */
package main package main
import (
"git.ouxuan.net/hasaki-service/hasaki-sdk/hskdb"
"xorm.io/xorm"
)
type MyTestr struct { type MyTestr struct {
Id int Id int
} }
//wherePrimaryKey
func (myTestr *MyTestr) wherePrimaryKey() (q interface{}, args []interface{}) {
//todo 根据需求修改
return "`id`=?", []interface{}{
myTestr.Id,
}
}
func (myTestr *MyTestr) getXorm() *xorm.Engine {
return hskdb.GetXormAuto()
}
type MyTestr2 struct { type MyTestr2 struct {
Id int Id int
} }

Loading…
Cancel
Save