Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
0e570f8a
Commit
0e570f8a
authored
Mar 05, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6108dadf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
29 deletions
+52
-29
t/neo/zodb/str.go
t/neo/zodb/str.go
+52
-0
t/neo/zodb/zodb.go
t/neo/zodb/zodb.go
+0
-29
No files found.
t/neo/zodb/str.go
0 → 100644
View file @
0e570f8a
// TODO copyright / license
// formatting and scanning for basic zodb types
package
zodb
import
(
"fmt"
"encoding/hex"
)
func
(
tid
Tid
)
String
()
string
{
// XXX also print "tid:" prefix ?
return
fmt
.
Sprintf
(
"%016x"
,
uint64
(
tid
))
}
func
(
oid
Oid
)
String
()
string
{
// XXX also print "oid:" prefix ?
return
fmt
.
Sprintf
(
"%016x"
,
uint64
(
oid
))
}
// XXX move me out of here
// bint converts bool to int with true => 1; false => 0
func
bint
(
b
bool
)
int
{
if
b
{
return
1
}
else
{
return
0
}
}
func
(
xtid
XTid
)
String
()
string
{
// XXX also print "tid:" prefix ?
return
fmt
.
Sprintf
(
"%c%v"
,
"=<"
[
bint
(
xtid
.
TidBefore
)],
xtid
.
Tid
)
}
func
(
xid
Xid
)
String
()
string
{
return
xid
.
XTid
.
String
()
+
":"
+
xid
.
Oid
.
String
()
// XXX use "·" instead of ":" ?
}
func
ParseTid
(
s
string
)
(
Tid
,
error
)
{
// -> scanf("%016x")
var
b
[
8
]
byte
if
hex
.
DecodedLdn
(
len
(
s
))
!=
8
{
return
0
,
fmt
.
Errorf
(
"hex64parse: %q invalid len"
,
s
)
// XXX
}
_
,
err
=
hex
.
Decode
(
b
[
:
],
mem
.
Bytes
(
s
))
if
err
!=
nil
{
...
}
}
t/neo/zodb/zodb.go
View file @
0e570f8a
...
...
@@ -45,35 +45,6 @@ func (tid Tid) Valid() bool {
}
}
func
(
tid
Tid
)
String
()
string
{
// XXX also print "tid:" prefix ?
return
fmt
.
Sprintf
(
"%016x"
,
uint64
(
tid
))
}
func
(
oid
Oid
)
String
()
string
{
// XXX also print "oid:" prefix ?
return
fmt
.
Sprintf
(
"%016x"
,
uint64
(
oid
))
}
// XXX move me out of here
// bint converts bool to int with true => 1; false => 0
func
bint
(
b
bool
)
int
{
if
b
{
return
1
}
else
{
return
0
}
}
func
(
xtid
XTid
)
String
()
string
{
// XXX also print "tid:" prefix ?
return
fmt
.
Sprintf
(
"%c%v"
,
"=<"
[
bint
(
xtid
.
TidBefore
)],
xtid
.
Tid
)
}
func
(
xid
Xid
)
String
()
string
{
return
xid
.
XTid
.
String
()
+
":"
+
xid
.
Oid
.
String
()
// XXX use "·" instead of ":" ?
}
// ----------------------------------------
// ErrOidMissing is an error which tells that there is no such oid in the database at all
...
...
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