[skip ci] Add comment for exported items in data_codec.go (#12089)

Signed-off-by: shaoyue.chen <shaoyue.chen@zilliz.com>
pull/12094/head
shaoyue 2021-11-18 19:15:27 +08:00 committed by GitHub
parent 7066e75112
commit 1587214676
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -59,19 +59,24 @@ type (
Timestamp = typeutil.Timestamp
)
// InvalidUniqueID is used when the UniqueID is not set (like in return with err)
const InvalidUniqueID = UniqueID(-1)
// Blob is a pack of key&value
type Blob struct {
Key string
Value []byte
}
// BlobList implements sort.Interface for a list of Blob
type BlobList []*Blob
// Len implements Len in sort.Interface
func (s BlobList) Len() int {
return len(s)
}
// Len implements Less in sort.Interface
func (s BlobList) Less(i, j int) bool {
leftValues := strings.Split(s[i].Key, "/")
rightValues := strings.Split(s[j].Key, "/")
@ -80,14 +85,17 @@ func (s BlobList) Less(i, j int) bool {
return left < right
}
// Len implements Swap in sort.Interface
func (s BlobList) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
// GetKey returns the key of blob
func (b Blob) GetKey() string {
return b.Key
}
// GetValue returns the value of blob
func (b Blob) GetValue() []byte {
return b.Value
}