554325746@qq.com
2019-06-25 f9ecff08394b734fb8420044bcba471df1af352c
add protobuf struct for baseinfo
1个文件已删除
3个文件已修改
50 ■■■■■ 已修改文件
esutil/EsApi.go 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
esutil/EsClient.go 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
esutil/EsStruct.go 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
shardmap/shardmap.go 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
esutil/EsApi.go
@@ -3,9 +3,11 @@
import (
        "errors"
        "strconv"
        "basic.com/pubsub/protomsg.git"
        )
func DbPersoninfos( queryindex int, querynums int ) (dbpersoninfos []Baseinfo, err error){
func DbPersoninfos( queryindex int, querynums int ) (dbpersoninfos []protomsg.Baseinfo, err error){
            point   := strconv.Itoa(queryindex)
            number   := strconv.Itoa(querynums)
@@ -32,14 +34,19 @@
                       ]
                }`
      // 返回请求的buf
      buf, err := GetDbinfo(dbinfoRequest )
      if err != nil {
        return nil ,errors.New("http request get dbperson info is err!")
      }
      // 返回 _source 数组
      sources, err := Sourcelist(buf)
      if err != nil {
            return nil,err 
      }
      // 返回所有查询的数据
      dbpersoninfos =  Parsesources(sources)
      return dbpersoninfos, nil
}
esutil/EsClient.go
@@ -8,6 +8,8 @@
    "net/http"
    "time"
    "bytes"
    "basic.com/pubsub/protomsg.git"
)
@@ -17,9 +19,9 @@
}
func Parsesources(sources []map[string]interface{}) []Baseinfo {
    var tmpinfo Baseinfo
    var baseinfos []Baseinfo
func Parsesources(sources []map[string]interface{}) []protomsg.Baseinfo {
    var tmpinfo protomsg.Baseinfo
    var baseinfos []protomsg.Baseinfo
    var ok bool
    for _, source := range sources {
esutil/EsStruct.go
File was deleted
shardmap/shardmap.go
@@ -5,6 +5,8 @@
import (
    "sync"
    "fmt"
    "basic.com/pubsub/protomsg.git"
)
const (
@@ -81,11 +83,11 @@
}
// modify by long.
func (s *ShardMap) Walk(wf wfOp, cfrom string) []interface{} {
func (s *ShardMap) Walk(wf wfOp, cfrom string) []protomsg.Baseinfo{
    var wg sync.WaitGroup
    var second float32 
    var baseinfos []interface{}
    var baseinfos []protomsg.Baseinfo
    for _, si := range s.shards {
        wg.Add(1)
@@ -97,12 +99,14 @@
                 if second == -1 {
                        continue 
                 }
                 fmt.Println("比对分数: ", second)
                 baseinfos = append(baseinfos, value )
                 if info, ok := value.(protomsg.Baseinfo) ;ok {
                    fmt.Println("比对分数: ", second)
                    info.CompareScore = second
                    baseinfos = append(baseinfos,info)
                 }
            }
            s.RUnlock()
        }(si,wf, cfrom)
    }
    wg.Wait()
    return baseinfos