Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | |
| 3 // that can be found in the LICENSE file. | |
| 4 | |
| 5 package datastore | |
| 6 | |
| 7 import ( | |
| 8 "golang.org/x/net/context" | |
| 9 ) | |
| 10 | |
| 11 // Transaction is a generic interface used to describe a Datastore transaction. | |
| 12 // | |
| 13 // The nil Transaction represents no transaction context. | |
| 14 type Transaction interface{} | |
|
dnj
2016/09/01 15:25:40
ATM this is just an empty interface. At some point
iannucci
2016/09/16 01:01:13
discussed offline, but I think the only thing we'd
dnj
2016/09/16 05:44:43
Added some comment.
| |
| 15 | |
| 16 // WithTransaction returns a Context with the supplied datastore Transaction | |
| 17 // instance installed. | |
| 18 func WithTransaction(c context.Context, t Transaction) context.Context { | |
| 19 return Raw(c).WithTransaction(t) | |
| 20 } | |
| 21 | |
| 22 // CurrentTransaction returns a reference to the current Transaction, or nil | |
| 23 // if the Context does not have a current Transaction. | |
| 24 func CurrentTransaction(c context.Context) Transaction { | |
| 25 return Raw(c).CurrentTransaction() | |
| 26 } | |
| OLD | NEW |