Skip to content

Commit

Permalink
Export client.NewTx.
Browse files Browse the repository at this point in the history
  • Loading branch information
Feng Zhou committed Aug 3, 2022
1 parent cae6772 commit eafdde0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Tx struct {
ctx context.Context
}

func (c *Client) newTx(ctx context.Context) *Tx {
func (c *Client) NewTx(ctx context.Context) *Tx {
tx := Tx{
baseClient: baseClient{
opt: c.opt,
Expand Down Expand Up @@ -65,7 +65,7 @@ func (c *Tx) Process(ctx context.Context, cmd Cmder) error {
//
// The transaction is automatically closed when fn exits.
func (c *Client) Watch(ctx context.Context, fn func(*Tx) error, keys ...string) error {
tx := c.newTx(ctx)
tx := c.NewTx(ctx)
defer tx.Close(ctx)
if len(keys) > 0 {
if err := tx.Watch(ctx, keys...).Err(); err != nil {
Expand Down

0 comments on commit eafdde0

Please sign in to comment.