Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-cidutil
Commits
cdef63fb
Commit
cdef63fb
authored
Oct 08, 2016
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 'Prefix' object and some more helper routines
parent
35c32d52
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
set.go
set.go
+12
-1
No files found.
set.go
View file @
cdef63fb
...
...
@@ -26,7 +26,7 @@ func (s *Set) Len() int {
}
func
(
s
*
Set
)
Keys
()
[]
*
Cid
{
var
out
[]
*
Cid
out
:=
make
([]
*
Cid
,
0
,
len
(
s
.
set
))
for
k
,
_
:=
range
s
.
set
{
c
,
_
:=
Cast
([]
byte
(
k
))
out
=
append
(
out
,
c
)
...
...
@@ -42,3 +42,14 @@ func (s *Set) Visit(c *Cid) bool {
return
false
}
func
(
s
*
Set
)
ForEach
(
f
func
(
c
*
Cid
)
error
)
error
{
for
cs
,
_
:=
range
s
.
set
{
c
,
_
:=
Cast
([]
byte
(
cs
))
err
:=
f
(
c
)
if
err
!=
nil
{
return
err
}
}
return
nil
}
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