add if tableid== , range all
| | |
| | | // Getdbpersonmsg("") |
| | | //} |
| | | |
| | | func Getdbpersonmsg(tableid, teststring string, IsCompare bool) ([]byte) { |
| | | func Getdbpersonmsg(tableid string, teststring []byte, IsCompare bool) ([]byte) { |
| | | |
| | | var buf []byte |
| | | if !IsCompare { |
| | | return nil |
| | | } |
| | | |
| | | if teststring == "" { |
| | | if tableid == "" { |
| | | return nil |
| | | } |
| | | |
| | | if tableid == "" { |
| | | for _, val := range Cmap.cam{ |
| | | tmpbuf := val.Walk(Printest, teststring) |
| | | buf =append(buf, tmpbuf...) |
| | | } |
| | | |
| | | }else{ |
| | | |
| | | for id, value := range Cmap.cam{ |
| | | if id == tableid{ |
| | | fmt.Println(id) |
| | | buf =value.Walk(Printest, teststring) |
| | | break |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | return buf |
| | | } |
| | | |
| | | func Printest(ci, co string ) (float32){ |
| | | |
| | | //ci_d, err := base64.StdEncoding.DecodeString(ci) |
| | | //if err != nil { |
| | | // fmt.Println("ci_d : error : ", err) |
| | | // return -1 |
| | | //} |
| | | func Printest(ci []byte, co string ) (float32){ |
| | | |
| | | co_d, err := base64.StdEncoding.DecodeString(co) |
| | | if err != nil { |
| | |
| | | return -1 |
| | | } |
| | | |
| | | sec := gosdk.FaceCompare([]byte(ci), co_d) |
| | | sec := gosdk.FaceCompare(ci, co_d) |
| | | return sec |
| | | } |
| | |
| | | |
| | | var Count = make(chan int) |
| | | |
| | | type wfOp func(a, b string) float32 |
| | | type wfOp func(a []byte, b string) float32 |
| | | |
| | | /** |
| | | * @param uint8, shardCnt must be pow of two |
| | |
| | | } |
| | | |
| | | // modify by long. |
| | | func (s *ShardMap) Walk(wf wfOp, cfrom string) ([]byte){ |
| | | func (s *ShardMap) Walk(wf wfOp, cfrom []byte) ([]byte){ |
| | | var wg sync.WaitGroup |
| | | var second float32 |
| | | var buf []byte |
| | |
| | | |
| | | wg.Add(1) |
| | | |
| | | go func(st *shardItem, fw wfOp, cf string) { |
| | | go func(st *shardItem, fw wfOp, cf []byte) { |
| | | defer wg.Done() |
| | | commonmux.Lock() |
| | | for id, feature := range st.data { |