es

package module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2023 License: MulanPSL-2.0 Imports: 11 Imported by: 0

README

gsf-es

db config json

component

{
  "keep_alive_time": 5,
  "max_idle_time": 60,
  "max_con_time": 3,
  "slow_threshold": 300
}

client

{
  "host": [
    "127.0.0.1:9800"
  ],
  "user": "",
  "pwd": "",
  "idle_limit": 2
}

命令行参数

--es-conn-timeout value          es connect timeout (default: 0)
--es-idle-timeout value          es idle connect timeout (default: 0)
--es-keepalive-time value        es keepalive time (default: 0)
--es-slow-threshold value        es slow threshold (default: 0)
--es-{{key}}-idle-limit value    es({{key}}) idle max count (default: 0)
--es-{{key}}-dsn value           es({{key}}) DSN (format: {{user}}:{{password}}@{{host}},{{host}})

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateClient = defaultNewClient

Functions

This section is empty.

Types

type Client

type Client struct {
	Client *elasticsearch.Client
	Cfg    ClientConfig
}

func (*Client) CliFlags added in v0.3.0

func (c *Client) CliFlags(name string) []cli.Flag

func (*Client) Load added in v0.3.0

func (c *Client) Load(name string, cfg *ComponentConfig) (err error)

type ClientConfig added in v0.3.0

type ClientConfig struct {
	Host        []string `json:"host"       yaml:"host"`
	Pwd         string   `json:"pwd"        yaml:"pwd"`
	User        string   `json:"user"       yaml:"user"`
	MaxIdleConn int      `json:"idle_limit" yaml:"idle_limit"`
}

type Component

type Component struct {
	DSNPrint bool
	Cfg      ComponentConfig
	Clts     map[string]*Client
}

func (*Component) CliFlags

func (c *Component) CliFlags() []cli.Flag

func (*Component) Close

func (c *Component) Close() error

func (*Component) Init added in v0.0.6

func (c *Component) Init(l logger.Interface, cfg *gsf.AppConfig, ctx *cli.Context) error

func (*Component) LoadOne added in v0.3.0

func (c *Component) LoadOne(name string) (err error)

func (*Component) Run

func (c *Component) Run() (err error)

type ComponentConfig added in v0.3.0

type ComponentConfig struct {
	MaxConnTime   int `json:"max_con_time"    yaml:"max_con_time"`
	MaxIdleTime   int `json:"max_idle_time"   yaml:"max_idle_time"`
	KeepAliveTime int `json:"keep_alive_time" yaml:"keep_alive_time"`
	SlowThreshold int `json:"slow_threshold"  yaml:"slow_threshold"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL