Skip to content

Commit

Permalink
Change TransactionWithClient signature.
Browse files Browse the repository at this point in the history
  • Loading branch information
mehran-prs committed Feb 21, 2020
1 parent 6f8323d commit 023fefb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ type TransactionFunc func(session mongo.Session, sc mongo.SessionContext) error

// Transaction run a transaction with default client..
func Transaction(f TransactionFunc) error {
return TransactionWithClient(client, ctx(), f)
return TransactionWithClient(ctx(), client, f)
}

// TransactionWithCtx run transaction with the given context and default client.
func TransactionWithCtx(ctx context.Context, f TransactionFunc) error {
return TransactionWithClient(client, ctx, f)
return TransactionWithClient(ctx, client, f)
}

// TransactionWithClient run transaction with the given client.
func TransactionWithClient(client *mongo.Client, ctx context.Context, f TransactionFunc) error {
func TransactionWithClient(ctx context.Context, client *mongo.Client, f TransactionFunc) error {
session, err := client.StartSession() //start session need to get options.
if err != nil {
return err
Expand Down

0 comments on commit 023fefb

Please sign in to comment.