智莺生活mysql模型库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cmd_dao.bat 818 B

5 months ago
1234567891011121314151617181920
  1. @echo off
  2. setlocal
  3. set "BasePath=./"
  4. REM 假设已经提供了接口名作为参数
  5. set "InterfaceName=%~1"
  6. REM 将接口名转换为小写并设置最终文件名
  7. for /f "delims=" %%i in ('powershell -Command "('%InterfaceName%').ToLower()"') do set "LowerInterfaceName=%%i"
  8. set "FinalFile=%BasePath%src\dao\%LowerInterfaceName%_dao.go"
  9. REM 使用 PowerShell 替换接口名称,并指定 UTF-8 编码
  10. powershell -Command "(Get-Content '%BasePath%etc\template\template_interface.tpl') -replace 'DemoInterface', '%InterfaceName%' | Out-File -FilePath '%BasePath%temp_interface.go' -Encoding UTF8"
  11. REM 如果需要,将临时文件重命名为最终文件(取决于move Y?N)
  12. move /Y "%BasePath%temp_interface.go" "%FinalFile%"
  13. endlocal
  14. echo Interface file %LowerInterfaceName%_dao.go generated successfully.