Chore: use any rather than interface{} (#74066)

This commit is contained in:
Ryan McKinley
2023-08-30 18:46:47 +03:00
committed by GitHub
parent 3e272d2bda
commit 025b2f3011
525 changed files with 2528 additions and 2528 deletions
+5 -5
View File
@@ -16,7 +16,7 @@ func TestBatching(t *testing.T) {
t.Run("InBatches", func(t *testing.T) {
t.Run("calls fn 0 times if items is empty", func(t *testing.T) {
var calls int
fn := func(batch interface{}) error { calls += 1; return nil }
fn := func(batch any) error { calls += 1; return nil }
opts := BulkOpSettings{BatchSize: DefaultBatchSize}
err := InBatches([]int{}, opts, fn)
@@ -27,7 +27,7 @@ func TestBatching(t *testing.T) {
t.Run("succeeds if batch size is nonpositive", func(t *testing.T) {
var calls int
fn := func(batch interface{}) error { calls += 1; return nil }
fn := func(batch any) error { calls += 1; return nil }
opts := BulkOpSettings{BatchSize: DefaultBatchSize}
err := InBatches([]int{1, 2, 3}, opts, fn)
@@ -38,7 +38,7 @@ func TestBatching(t *testing.T) {
t.Run("rejects if items is not a slice", func(t *testing.T) {
var calls int
fn := func(batch interface{}) error { calls += 1; return nil }
fn := func(batch any) error { calls += 1; return nil }
opts := BulkOpSettings{BatchSize: DefaultBatchSize}
err := InBatches("lol", opts, fn)
@@ -48,7 +48,7 @@ func TestBatching(t *testing.T) {
t.Run("calls expected number of times when batch size does not evenly divide length", func(t *testing.T) {
var calls int
fn := func(batch interface{}) error { calls += 1; return nil }
fn := func(batch any) error { calls += 1; return nil }
opts := BulkOpSettings{BatchSize: 5}
vals := make([]int, 93)
@@ -86,7 +86,7 @@ func TestIntegrationBulkOps(t *testing.T) {
})
}
func assertTableCount(t *testing.T, db *SQLStore, table interface{}, expCount int64) {
func assertTableCount(t *testing.T, db *SQLStore, table any, expCount int64) {
t.Helper()
err := db.WithDbSession(context.Background(), func(sess *DBSession) error {
total, err := sess.Table(bulkTestItem{}).Count()