public_host 4 years ago
parent
commit
7d5c746812
  1. 12
      hasaki-gen-crud/hasaki-gen-crud.js
  2. 17
      test.go

12
hasaki-gen-crud/hasaki-gen-crud.js

@ -148,15 +148,21 @@ try {
let httpFileName = path.join(fileDir, `auto_generated_http_crud_${underscore_naming}_${struct}_${fileBaseName}`)
fs.writeFile(crudFileName, `${package_src}\n\n${tmp[2]}`, function () {
cp.exec(`gopls fix -a -w ${crudFileName}`, function () { })
cp.exec(`gopls fix -a -w ${crudFileName}`, function (e) {
console.log(e)
})
})
fs.writeFile(httpFileName, `${package_src}\n\n${tmp[3]}`, function () {
cp.exec(`gopls fix -a -w ${httpFileName}`, function () { })
cp.exec(`gopls fix -a -w ${httpFileName}`, function (e) {
console.log(e)
})
})
cp.exec(`gopls fix -a -w ${fileName}`, function () { })
cp.exec(`gopls fix -a -w ${fileName}`, function (e) {
console.log(e)
})
// vscode.window.showErrorMessage(res)

17
test.go

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

Loading…
Cancel
Save