1 Star 0 Fork 0

LynnYuan/golang

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
slice_s.go 1.13 KB
一键复制 编辑 原始数据 按行查看 历史
LynnYuan 提交于 2021-03-31 08:54 +08:00 . slice append test
package base
type RequestUnion struct {
word string
}
func (ru *RequestUnion) SetInner(val string) {
ru.word = val
}
type VecScanResponse struct {
ColBatch []VecValue
}
// columnar value batch: single column set
type VecValue struct {
ColId uint32
ColType int32
Values [][]uint32
}
func (vsr *VecScanResponse) Combine(oth VecScanResponse) error {
if vsr != nil {
//vsr.ColBatch = append(vsr.ColBatch, oth.ColBatch...)
vsrColNum := len(vsr.ColBatch)
othColNum := len(oth.ColBatch)
maxColNum := vsrColNum
if maxColNum < othColNum {
maxColNum = othColNum
}
for i := 0; i < maxColNum; i++ {
if maxColNum == vsrColNum {
if vsr.ColBatch[i].ColId == oth.ColBatch[i].ColId {
vsr.combineVecValue(oth.ColBatch, i)
} else {
}
} else {
}
}
//vsr.IntentRows = append(vsr.IntentRows, otherVSR.IntentRows...)
//if err := vsr.ResponseHeader.combine(otherVSR.Header()); err != nil {
// return err
//}
}
return nil
}
func (vsr *VecScanResponse) combineVecValue(colBatch []VecValue, i int) {
for _, v := range colBatch[i].Values {
vsr.ColBatch[i].Values = append(vsr.ColBatch[i].Values, v)
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/jianyun/golang.git
git@gitee.com:jianyun/golang.git
jianyun
golang
golang
dc61740a3abe

搜索帮助