498b235461
Build and test / Build and test AMD64 Ubuntu 22.04 (push) Failing after 0s
Publish Builder / amazonlinux2023 (push) Failing after 1s
Build and test / UT for Go (push) Has been skipped
Publish KRTE Images / KRTE (push) Failing after 1s
Build and test / Integration Test (push) Has been skipped
Build and test / Upload Code Coverage (push) Has been skipped
Publish Builder / rockylinux9 (push) Failing after 1s
Publish Builder / ubuntu22.04 (push) Failing after 0s
Publish Builder / ubuntu24.04 (push) Failing after 0s
Publish Gpu Builder / publish-gpu-builder (push) Failing after 1s
Publish Test Images / PyTest (push) Failing after 0s
Build and test / UT for Cpp (push) Has been cancelled
37 lines
787 B
Go
37 lines
787 B
Go
package common
|
|
|
|
import (
|
|
"reflect"
|
|
|
|
"github.com/milvus-io/milvus-proto/go-api/v3/commonpb"
|
|
)
|
|
|
|
type KeyDataPairs []*commonpb.KeyDataPair
|
|
|
|
func (pairs KeyDataPairs) Clone() KeyDataPairs {
|
|
clone := make(KeyDataPairs, 0, len(pairs))
|
|
for _, pair := range pairs {
|
|
clone = append(clone, &commonpb.KeyDataPair{
|
|
Key: pair.GetKey(),
|
|
Data: CloneByteSlice(pair.GetData()),
|
|
})
|
|
}
|
|
return clone
|
|
}
|
|
|
|
func (pairs KeyDataPairs) ToMap() map[string][]byte {
|
|
ret := make(map[string][]byte)
|
|
for _, pair := range pairs {
|
|
ret[pair.GetKey()] = CloneByteSlice(pair.GetData())
|
|
}
|
|
return ret
|
|
}
|
|
|
|
func (pairs KeyDataPairs) Equal(other KeyDataPairs) bool {
|
|
return reflect.DeepEqual(pairs.ToMap(), other.ToMap())
|
|
}
|
|
|
|
func CloneKeyDataPairs(pairs KeyDataPairs) KeyDataPairs {
|
|
return pairs.Clone()
|
|
}
|