You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

46 lines
848 B

package merkle
import "bytes"
type String string
type ByteSlice []byte
func (self String) Equals(other Key) bool {
if o, ok := other.(String); ok {
return self == o
} else {
return false
}
}
func (self String) Less(other Key) bool {
if o, ok := other.(String); ok {
return self < o
} else {
return false
}
}
func (self String) Bytes() []byte {
return []byte(self)
}
func (self ByteSlice) Equals(other Key) bool {
if o, ok := other.(ByteSlice); ok {
return bytes.Equal(self, o)
} else {
return false
}
}
func (self ByteSlice) Less(other Key) bool {
if o, ok := other.(ByteSlice); ok {
return bytes.Compare(self, o) < 0 // -1 if a < b
} else {
return false
}
}
func (self ByteSlice) Bytes() []byte {
return []byte(self)
}