Skip to content

Commit d33d1f1

Browse files
committed
BaseMapper method with context param.
1 parent 56012b1 commit d33d1f1

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

pkg/mapper/base.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,24 @@
66

77
package mapper
88

9+
import "context"
10+
911
type BaseMapper[T any] interface {
10-
Insert(entity T) int64
12+
Insert(ctx context.Context, entity T) int64
1113

12-
InsertBatch(entities ...T) (int64, int64)
14+
InsertBatch(ctx context.Context, entities ...T) (int64, int64)
1315

14-
DeleteById(id any) int64
16+
DeleteById(ctx context.Context, id any) int64
1517

16-
DeleteBatchIds(ids []any) int64
18+
DeleteBatchIds(ctx context.Context, ids []any) int64
1719

18-
UpdateById(entity T) int64
20+
UpdateById(ctx context.Context, entity T) int64
1921

20-
SelectById(id any) T
22+
SelectById(ctx context.Context, id any) T
2123

22-
SelectBatchIds(ids []any) []T
24+
SelectBatchIds(ctx context.Context, ids []any) []T
2325

24-
SelectOne(entity T) T
26+
SelectOne(ctx context.Context, entity T) T
2527

26-
SelectCount(entity T) int64
28+
SelectCount(ctx context.Context, entity T) int64
2729
}

0 commit comments

Comments
 (0)