Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
fcab58ca
Commit
fcab58ca
authored
Oct 02, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/zodb: Connection += .At()
To know database state corresponding to the connection.
parent
9112f21e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
go/zodb/connection.go
go/zodb/connection.go
+14
-0
No files found.
go/zodb/connection.go
View file @
fcab58ca
...
@@ -130,6 +130,12 @@ func newConnection(db *DB, at Tid) *Connection {
...
@@ -130,6 +130,12 @@ func newConnection(db *DB, at Tid) *Connection {
}
}
}
}
// At returns database state corresponding to the connection.
func
(
conn
*
Connection
)
At
()
Tid
{
conn
.
checkLive
(
"at"
)
return
conn
.
at
}
// wrongClassError is the error cause returned when ZODB object's class is not what was expected.
// wrongClassError is the error cause returned when ZODB object's class is not what was expected.
type
wrongClassError
struct
{
type
wrongClassError
struct
{
want
,
have
string
want
,
have
string
...
@@ -238,3 +244,11 @@ func (conn *Connection) checkTxn(txn transaction.Transaction, who string) {
...
@@ -238,3 +244,11 @@ func (conn *Connection) checkTxn(txn transaction.Transaction, who string) {
panic
(
"connection: "
+
who
+
"current transaction is different from connection transaction"
)
panic
(
"connection: "
+
who
+
"current transaction is different from connection transaction"
)
}
}
}
}
// checkLive asserts that the connection is alive - the transaction under which
// it has been opened is not yet complete.
func
(
conn
*
Connection
)
checkLive
(
who
string
)
{
if
conn
.
txn
==
nil
{
panic
(
"connection: "
+
who
+
": connection is not live"
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment