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

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

@ -148,20 +148,20 @@ 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 (e) {
console.log(e)
cp.exec(`gopls fix -a -w ${crudFileName}`, function (a, b, c) {
console.log(a, b, c)
})
})
fs.writeFile(httpFileName, `${package_src}\n\n${tmp[3]}`, function () {
cp.exec(`gopls fix -a -w ${httpFileName}`, function (e) {
console.log(e)
cp.exec(`gopls fix -a -w ${httpFileName}`, function (a, b, c) {
console.log(a, b, c)
})
})
cp.exec(`gopls fix -a -w ${fileName}`, function (e) {
console.log(e)
cp.exec(`gopls fix -a -w ${fileName}`, function (a, b, c) {
console.log(a, b, c)
})

17
test.go

@ -3,10 +3,27 @@
*/
package main
import (
"git.ouxuan.net/hasaki-service/hasaki-sdk/hskdb"
"xorm.io/xorm"
)
type MyTestr struct {
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 {
Id int
}

Loading…
Cancel
Save