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
ce2167fe
Commit
ce2167fe
authored
Aug 31, 2016
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some improvements from integrating into go-ipfs
parents
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
set.go
set.go
+35
-0
No files found.
set.go
0 → 100644
View file @
ce2167fe
package
cid
type
Set
struct
{
set
map
[
string
]
struct
{}
}
func
NewSet
()
*
Set
{
return
&
Set
{
set
:
make
(
map
[
string
]
struct
{})}
}
func
(
s
*
Set
)
Add
(
c
*
Cid
)
{
s
.
set
[
string
(
c
.
Bytes
())]
=
struct
{}{}
}
func
(
s
*
Set
)
Has
(
c
*
Cid
)
bool
{
_
,
ok
:=
s
.
set
[
string
(
c
.
Bytes
())]
return
ok
}
func
(
s
*
Set
)
Remove
(
c
*
Cid
)
{
delete
(
s
.
set
,
string
(
c
.
Bytes
()))
}
func
(
s
*
Set
)
Len
()
int
{
return
len
(
s
.
set
)
}
func
(
s
*
Set
)
Keys
()
[]
*
Cid
{
var
out
[]
*
Cid
for
k
,
_
:=
range
s
.
set
{
c
,
_
:=
Cast
([]
byte
(
k
))
out
=
append
(
out
,
c
)
}
return
out
}
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