@@ -40,5 +40,5 @@ | |||||
确保安装了所需的依赖,然后运行以下命令: | 确保安装了所需的依赖,然后运行以下命令: | ||||
```bash | ```bash | ||||
pip install -r requirements.txt | |||||
python main.py | |||||
.\cmd_db.bat HelloWorld | |||||
.\cmd_dao.bat HelloWorld |
@@ -0,0 +1,20 @@ | |||||
@echo off | |||||
setlocal | |||||
set "BasePath=./" | |||||
REM 假设已经提供了接口名作为参数 | |||||
set "InterfaceName=%~1" | |||||
REM 将接口名转换为小写并设置最终文件名 | |||||
for /f "delims=" %%i in ('powershell -Command "('%InterfaceName%').ToLower()"') do set "LowerInterfaceName=%%i" | |||||
set "FinalFile=%BasePath%src\dao\%LowerInterfaceName%_dao.go" | |||||
REM 使用 PowerShell 替换接口名称,并指定 UTF-8 编码 | |||||
powershell -Command "(Get-Content '%BasePath%etc\template\template_interface.tpl') -replace 'DemoInterface', '%InterfaceName%' | Out-File -FilePath '%BasePath%temp_interface.go' -Encoding UTF8" | |||||
REM 如果需要,将临时文件重命名为最终文件(取决于move Y?N) | |||||
move /Y "%BasePath%temp_interface.go" "%FinalFile%" | |||||
endlocal | |||||
echo Interface file %LowerInterfaceName%_dao.go generated successfully. |
@@ -16,7 +16,7 @@ set DBNAME="fnuoos_test1" | |||||
set DBHOST="119.23.182.117" | set DBHOST="119.23.182.117" | ||||
set DBPORT="3306" | set DBPORT="3306" | ||||
del "app\db\model\%Table%.go" | |||||
del "src\models\%Table%.go" | |||||
echo start reverse table %Table% | echo start reverse table %Table% | ||||
@@ -0,0 +1,5 @@ | |||||
package dao | |||||
type DemoInterfaceDao interface { | |||||
//TODO:: You can add specific method definitions here | |||||
} |
@@ -11,7 +11,7 @@ type happyOrchardRewardExchangeRecordsDb struct { | |||||
Db *xorm.Engine | Db *xorm.Engine | ||||
} | } | ||||
func NewHappyOrchardRewardExchangeRecordsDb(engine *xorm.Engine) dao.HappyOrchardRewardExchangeRecordsDao { | |||||
func NewHappyOrchardRewardExchangeRecordsDb123456(engine *xorm.Engine) dao.HappyOrchardRewardExchangeRecordsDao { | |||||
return &happyOrchardRewardExchangeRecordsDb{Db: engine} | return &happyOrchardRewardExchangeRecordsDb{Db: engine} | ||||
} | } | ||||