Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a suggestion to use "NewTransaction" instead of Transaction #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions pkg/ovsdb/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,19 +484,22 @@ func (ovsdb *OVSDB) GetSchema(schema string) (json.RawMessage, error) {
// ADVANCED FUNCTIONALITY CONSTRUCTORS
// ===================================

// Transaction returns transaction handle
func (ovsdb *OVSDB) Transaction(schema string) *dbtransaction.Transaction {
// NewTransaction is a constructor for a Transaction object, always returning a transaction object
func (ovsdb *OVSDB) NewTransaction(schema string) *dbtransaction.Transaction {
txn := new(dbtransaction.Transaction)

txn.OVSDB = ovsdb
txn.Schema = schema
txn.Tables = map[string]string{}
txn.References = make(map[string][]interface{})
txn.Counter = 1

return txn
}

// deprecated Transaction function, use NewTransaction instead
func (ovsdb *OVSDB) Transaction(schema string) *dbtransaction.Transaction {
return NewTransaction(schema)
}

func (ovsdb *OVSDB) Monitor(schema string) *dbmonitor.Monitor {
monitor := new(dbmonitor.Monitor)

Expand Down