bindbox-game/internal/repository/mysql/testrepo_sqlite.go
邹方成 2a89a1ab9d
Some checks failed
Build docker and publish / linux (1.24.5) (push) Failing after 39s
feat(admin): 更新前端资源文件及修复相关功能
refactor(service): 修改banner和guild删除逻辑为软删除
fix(service): 修复删除操作使用软删除而非物理删除

build: 添加SQLite测试仓库实现
docs: 新增奖励管理字段拆分和批量抽奖UI改造文档

ci: 更新CI忽略文件
style: 清理无用资源文件
2025-11-19 01:35:55 +08:00

23 lines
578 B
Go

package mysql
import (
"gorm.io/driver/sqlite"
"gorm.io/gorm"
)
type sqliteRepo struct {
DbR *gorm.DB
DbW *gorm.DB
}
func (d *sqliteRepo) i() {}
func (d *sqliteRepo) GetDbR() *gorm.DB { return d.DbR }
func (d *sqliteRepo) GetDbW() *gorm.DB { return d.DbW }
func (d *sqliteRepo) DbRClose() error { return nil }
func (d *sqliteRepo) DbWClose() error { return nil }
func NewSQLiteRepoForTest() (Repo, error) {
db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
if err != nil { return nil, err }
return &sqliteRepo{DbR: db, DbW: db}, nil
}