esclient

package module
v0.3.14 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 8 Imported by: 0

README

Examples

go run ./example/search_dy_id.go --index=twitter --type=tweet --url="http://127.0.0.1:9200" --req=102309

go run ./example/search_request.go --index=twitter --type=tweet --url="http://127.0.0.1:9200" --req=1 --sort=title --field=title

Documentation

Index

Constants

View Source
const (
	PingDuration = 5 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func (*Client) Debug added in v0.1.0

func (o *Client) Debug() IDebug

func (Client) Error added in v0.1.0

func (o Client) Error() error

func (Client) Get added in v0.1.0

func (o Client) Get() *elastic.Client

type ConnectionType

type ConnectionType int
const (
	SimpleType ConnectionType = iota
	DialType
	DialContextType
	ClientType
)

type DebugHandler

type DebugHandler struct {
	// contains filtered or unexported fields
}

func (*DebugHandler) Request

func (d *DebugHandler) Request() []byte

func (*DebugHandler) Response

func (d *DebugHandler) Response() []byte

type FakeClient added in v0.3.1

type FakeClient struct {
	elastic.Client
}

type IClient

type IClient interface {
	Get() *elastic.Client
	Error() error // connection error
	Debug() IDebug
}

type IConn added in v0.1.0

type IConn interface {
	Open(bool, ...context.Context) IClient
	Sniff(context.Context)
	SetLogger(ILogger)
	SniffTimeout(time.Duration)

	// SetCustomHandler is a setter
	SetCustomHandler(ReqHandler, ResHandler) error
	// contains filtered or unexported methods
}

func Dial

func Dial(options ...elastic.ClientOptionFunc) (IConn, error)

func DialContext

func DialContext(ctx context.Context, options ...elastic.ClientOptionFunc) (IConn, error)

func NewClient

func NewClient(options ...elastic.ClientOptionFunc) (IConn, error)

func NewSimpleClient

func NewSimpleClient(options ...elastic.ClientOptionFunc) (IConn, error)

type IDebug

type IDebug interface {
	// Request  returns full http request
	Request() []byte

	// Response returns full http response
	Response() []byte
}

type ILogger added in v0.3.1

type ILogger interface {
	Fatal(v ...interface{})
	Print(v ...interface{})
	Printf(format string, v ...interface{})
}

type ReqHandler

type ReqHandler func(*http.Request)

type ResHandler

type ResHandler func(*http.Response, error) (*http.Response, error)

type RoundTripper

type RoundTripper struct {
	ReqFunc ReqHandler
	ResFunc ResHandler

	CustomReqFun ReqHandler
	CustomResFun ResHandler
	// contains filtered or unexported fields
}

see https://golang.org/pkg/net/http/#RoundTripper

func (RoundTripper) RoundTrip

func (r RoundTripper) RoundTrip(request *http.Request) (*http.Response, error)

type RoundTripperCustom added in v0.3.13

type RoundTripperCustom struct {
	CustomReqFun ReqHandler
	CustomResFun ResHandler
	// contains filtered or unexported fields
}

see https://golang.org/pkg/net/http/#RoundTripper

func (RoundTripperCustom) RoundTrip added in v0.3.13

func (r RoundTripperCustom) RoundTrip(request *http.Request) (*http.Response, error)

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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