@@ -23,10 +23,10 @@ func NewRetryExecutor(db *sql.DB) *RetryExecutor {
2323 return & RetryExecutor {db : db }
2424}
2525
26- // DoTx executes the operation within a transaction with retry support.
27- // It uses ydb-go-sdk's retry.DoTx which handles YDB-specific retryable errors.
26+ // Do executes a read-only operation with retry support.
27+ // It uses ydb-go-sdk's retry.Do which handles YDB-specific retryable errors.
2828// Options should be created using retry.WithIdempotent(), retry.WithLabel(), etc.
29- func (r * RetryExecutor ) DoTx (
29+ func (r * RetryExecutor ) Do (
3030 ctx context.Context ,
3131 fn func (ctx context.Context , drv dialect.Driver ) error ,
3232 opts ... any ,
@@ -38,20 +38,20 @@ func (r *RetryExecutor) DoTx(
3838 }
3939 }
4040
41- return retry .DoTx (
41+ return retry .Do (
4242 ctx ,
4343 r .db ,
44- func (ctx context.Context , tx * sql.Tx ) error {
45- return fn (ctx , NewTxRetryDriver ( tx ))
44+ func (ctx context.Context , conn * sql.Conn ) error {
45+ return fn (ctx , NewRetryDriver ( conn ))
4646 },
47- retry .WithDoTxRetryOptions (retryOpts ... ),
47+ retry .WithDoRetryOptions (retryOpts ... ),
4848 )
4949}
5050
51- // Do executes a read-only operation with retry support.
52- // It uses ydb-go-sdk's retry.Do which handles YDB-specific retryable errors.
51+ // DoTx executes the operation within a transaction with retry support.
52+ // It uses ydb-go-sdk's retry.DoTx which handles YDB-specific retryable errors.
5353// Options should be created using retry.WithIdempotent(), retry.WithLabel(), etc.
54- func (r * RetryExecutor ) Do (
54+ func (r * RetryExecutor ) DoTx (
5555 ctx context.Context ,
5656 fn func (ctx context.Context , drv dialect.Driver ) error ,
5757 opts ... any ,
@@ -63,13 +63,13 @@ func (r *RetryExecutor) Do(
6363 }
6464 }
6565
66- return retry .Do (
66+ return retry .DoTx (
6767 ctx ,
6868 r .db ,
69- func (ctx context.Context , conn * sql.Conn ) error {
70- return fn (ctx , NewRetryDriver ( conn ))
69+ func (ctx context.Context , tx * sql.Tx ) error {
70+ return fn (ctx , NewTxRetryDriver ( tx ))
7171 },
72- retry .WithDoRetryOptions (retryOpts ... ),
72+ retry .WithDoTxRetryOptions (retryOpts ... ),
7373 )
7474}
7575
@@ -102,7 +102,7 @@ func (d *RetryDriver) Tx(ctx context.Context) (dialect.Tx, error) {
102102 return dialect .NopTx (d ), nil
103103}
104104
105- // Close is a no-op for TxDriver since retry.DoTx manages the transaction lifecycle.
105+ // Close is a no-op for RetryDriver since retry.DoTx manages the transaction lifecycle.
106106func (d * RetryDriver ) Close () error {
107107 return nil
108108}
0 commit comments