fix(test): 修复 CI 测试和 lint 错误
- 为所有 mock 实现添加 GetByIDs 方法以满足 AccountRepository 接口 - 重构 account_handler.go 中的类型断言,使用类型安全的变量 - 修复 gofmt 格式问题
This commit is contained in:
@@ -25,6 +25,16 @@ func (m *mockAccountRepoForGemini) GetByID(ctx context.Context, id int64) (*Acco
|
||||
return nil, errors.New("account not found")
|
||||
}
|
||||
|
||||
func (m *mockAccountRepoForGemini) GetByIDs(ctx context.Context, ids []int64) ([]*Account, error) {
|
||||
var result []*Account
|
||||
for _, id := range ids {
|
||||
if acc, ok := m.accountsByID[id]; ok {
|
||||
result = append(result, acc)
|
||||
}
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (m *mockAccountRepoForGemini) ExistsByID(ctx context.Context, id int64) (bool, error) {
|
||||
if m.accountsByID == nil {
|
||||
return false, nil
|
||||
|
||||
Reference in New Issue
Block a user