// RunInTransaction runs a datastore transaction
RunInTransaction runs a datastore transaction
// RunInTransaction runs a datastore transaction
func (c *Client) RunInTransaction(ctx context.Context, f func(tx *Transaction) error, opts ...datastore.TransactionOption) error {
	var txn *Transaction
	_, err := c.DSClient.RunInTransaction(ctx, func(tx *datastore.Transaction) error {
		txn = &Transaction{
			txn:       tx,
			deleteMap: make(map[string]bool),
		}
		return f(txn)
	}, opts...)
	if err == nil {
		txn.txnLock.Lock()
		defer txn.txnLock.Unlock()
		if len(txn.deleteMap) > 0 {
			var keys []string
			for key := range txn.deleteMap {
				keys = append(keys, key)
			}
			c.deleteLocalCache(keys...)
			c.Cache.Delete(keys...)
		}
	} else {
		log.Printf("dscache.Client.RunInTransaction: %v", err)
	}
	return err
}
func ( c * Client ) RunInTransaction ( ctx context . Context , f func ( tx * Transaction ) error , opts ... datastore . TransactionOption ) error { var txn * Transaction _ , err := c . DSClient . RunInTransaction ( ctx , func ( tx * datastore . Transaction ) error { txn = & Transaction { txn : tx , deleteMap : make ( map [ string ] bool ) , } return f ( txn ) } , opts ... ) if err == nil { txn . txnLock . Lock ( ) defer txn . txnLock . Unlock ( ) if len ( txn . deleteMap ) > 0 { var keys [ ] string for key := range txn . deleteMap { keys = append ( keys , key ) } c . deleteLocalCache ( keys ... ) c . Cache . Delete ( keys ... ) } } else { log . Printf ( " " , err ) } return err }
RunInTransaction runs a datastore transaction
RunInTransaction runs a datastore transaction