chore: stabilize lint and verify builds

This commit is contained in:
2026-02-06 11:51:32 +08:00
parent edede17880
commit 1782f64417
114 changed files with 3032 additions and 1345 deletions

View File

@@ -22,9 +22,10 @@ func Truncate(ctx context.Context, db *sql.DB, tableName ...string) error {
for _, name := range tableName {
sql := fmt.Sprintf("TRUNCATE TABLE %s RESTART IDENTITY", name)
if _, err := db.ExecContext(ctx, sql); err != nil {
return err
return fmt.Errorf("truncate table %s: %w", name, err)
}
}
return nil
}
@@ -41,10 +42,15 @@ func WrapLikeRight(v string) string {
}
func Provide(...opt.Option) error {
return container.Container.Provide(func(db *gorm.DB) contracts.Initial {
if err := container.Container.Provide(func(db *gorm.DB) contracts.Initial {
models.SetDefault(db)
return models.Q
}, atom.GroupInitial)
}, atom.GroupInitial); err != nil {
return fmt.Errorf("provide database initial: %w", err)
}
return nil
}
func DefaultProvider() container.ProviderContainer {