forked from TrueCloudLab/frostfs-api-go
[#164] sdk/container: Implement Equal method on ID
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
1305bc750e
commit
cf70026c7e
3 changed files with 34 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
package container
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/sha256"
|
||||
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/refs"
|
||||
|
@ -30,3 +31,11 @@ func (id *ID) SetSHA256(v [sha256.Size]byte) {
|
|||
func (id *ID) ToV2() *refs.ContainerID {
|
||||
return (*refs.ContainerID)(id)
|
||||
}
|
||||
|
||||
// Equal returns true if identifiers are identical.
|
||||
func (id *ID) Equal(id2 *ID) bool {
|
||||
return bytes.Equal(
|
||||
(*refs.ContainerID)(id).GetValue(),
|
||||
(*refs.ContainerID)(id2).GetValue(),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue