feat:优化信息
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user