feat: 添加数据模型和存储层

- model: JobTemplate、SubmitJobRequest、JobHistoryQuery 等模型定义

- store: NewGormDB MySQL 连接池,使用 zap 日志替代 GORM 默认日志

- store: TemplateStore CRUD 操作,支持 GORM AutoMigrate

- NewGormDB 接受 gormLevel 参数,由上层传入配置值

- 完整 TDD 测试覆盖

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
dailz
2026-04-10 08:39:30 +08:00
parent f7a21ee455
commit fbfd5c5f42
9 changed files with 506 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
package store
import (
"testing"
"go.uber.org/zap"
)
func TestNewGormDBInvalidDSN(t *testing.T) {
_, err := NewGormDB("invalid:dsn@tcp(localhost:99999)/nonexistent?parseTime=true", zap.NewNop(), "warn")
if err == nil {
t.Fatal("expected error for invalid DSN, got nil")
}
}