feat:完善信息

This commit is contained in:
henry
2021-10-15 17:31:23 +08:00
parent ae9fb8ea0f
commit 282448ab6e
5 changed files with 39 additions and 0 deletions

32
serve/es/es.go Normal file
View File

@ -0,0 +1,32 @@
package es
import "github.com/elastic/go-elasticsearch/v7"
type Es struct{ *EsConfig }
type EsConfig struct {
Address []string
}
type EsServer func(*EsConfig) *Es
var esClient = new(elasticsearch.Client)
func (this *Es) Run() {
obj := elasticsearch.Config{
Addresses: this.Address,
Username: "",
Password: "",
}
var err error
if esClient, err = elasticsearch.NewClient(obj); err != nil {
panic("Elasticsearch Error " + err.Error())
}
}
func NewEs() EsServer {
return func(config *EsConfig) *Es {
return &Es{config}
}
}