feat:优化信息

This commit is contained in:
henry
2021-12-23 10:33:31 +08:00
parent f4c02860b4
commit 741138b3ea
5 changed files with 92 additions and 45 deletions

View File

@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"github.com/olivere/elastic/v7"
"reflect"
"strings"
"testing"
)
@ -91,12 +92,45 @@ func TestNewInstance1(t *testing.T) {
//t.Log(resp)
}
type Manage struct {
ID uint64 `json:"id"`
}
func TestNewInstance2(t *testing.T) {
NewInstance(
WithEsAddress([]string{"http://192.168.0.188:9200"}),
).Init().Local()
//NewInstance(
// WithEsAddress([]string{"http://192.168.0.188:9200"}),
//).Init().Local()
//client.Search(func(request *esapi.SearchRequest) {
//
//})
function := func(src interface{}) {
obj := reflect.ValueOf(src).Interface()
t.Log(obj)
var a interface{} = &Manage{ID: 123123}
out := make([]interface{}, 0)
out = append(out, a)
}
manage := new(Manage)
function(manage)
var a interface{} = &Manage{ID: 123123}
out := make([]interface{}, 0)
out = append(out, a)
t.Log(reflect.TypeOf(manage))
for _, v := range out {
t.Log(v.(*Manage))
}
t.Log(a)
}