druid

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

README

Join us

go-druid

A Golang client for Druid. Now supports Query API and Common API.

Development
Testing

go-druid uses mage to run tests locally. Install Mage:

    git clone https://github.com/magefile/mage
    cd mage
    go run bootstrap.go

mage -l provides a list of targets that can be run. Default is Check

Targets:
  build            runs go mod download and then installs the binary.
  check*           run linters and tests
  fmt              run gofmt linter
  lint             run golint linter https://github.com/golang/lint
  testCoverHTML    generates test coverage report
  testRace         run tests with race detector
  vet              run go vet linter

* default target

Documentation

Index

Constants

View Source
const (
	StatusEndpoint         = "status"
	PolarisStatusEndpoint  = "v1/apikeyinfo"
	HealthEndpoint         = "status/health"
	PropertiesEndpoint     = "status/properties"
	SelfDiscoveredEndpoint = "status/selfDiscovered/status"
)
View Source
const (
	NativeQueryEndpoint     = "druid/v2"
	SQLQueryEndpoint        = "druid/v2/sql"
	PolarisSQLQueryEndpoint = "v1/query/sql"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(baseURL string, options ...ClientOption) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Common

func (c *Client) Common() *CommonService

func (*Client) Do

func (c *Client) Do(r *retryablehttp.Request, result interface{}) (*Response, error)

func (*Client) ExecuteRequest

func (c *Client) ExecuteRequest(method, path string, opt, result interface{}) (*Response, error)

func (*Client) NewRequest

func (c *Client) NewRequest(method, path string, opt interface{}) (*retryablehttp.Request, error)

func (*Client) Query

func (c *Client) Query() *QueryService

type ClientOption

type ClientOption func(*clientOptions)

func WithBasicAuth

func WithBasicAuth(username, password string) ClientOption

func WithCustomBackoff

func WithCustomBackoff(backoff retryablehttp.Backoff) ClientOption

func WithCustomErrorHandler

func WithCustomErrorHandler(h retryablehttp.ErrorHandler) ClientOption

func WithCustomRetry

func WithCustomRetry(retry retryablehttp.CheckRetry) ClientOption

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) ClientOption

func WithPolarisConnection added in v0.1.2

func WithPolarisConnection(usePolaris bool) ClientOption

func WithRetryMax

func WithRetryMax(retryMax int) ClientOption

func WithRetryWaitMax

func WithRetryWaitMax(retryWaitMax time.Duration) ClientOption

func WithRetryWaitMin

func WithRetryWaitMin(retryWaitMin time.Duration) ClientOption

func WithSkipTLSVerify

func WithSkipTLSVerify() ClientOption

type CommonService

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

func (*CommonService) Health

func (c *CommonService) Health() (*Health, *Response, error)

func (*CommonService) Properties

func (c *CommonService) Properties() (*Properties, *Response, error)

func (*CommonService) SelfDiscovered

func (c *CommonService) SelfDiscovered() (*SelfDiscovered, *Response, error)

func (*CommonService) Status

func (c *CommonService) Status() (*Status, *Response, error)

type Health

type Health bool

type Properties

type Properties map[string]string

type QueryService

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

func (*QueryService) Execute

func (q *QueryService) Execute(qry builder.Query, result interface{}, headers ...http.Header) (*Response, error)

func (*QueryService) Load

func (q *QueryService) Load(data []byte) (builder.Query, error)

type Response

type Response struct {
	*http.Response
}

func (*Response) ExtractError

func (r *Response) ExtractError() error

type SelfDiscovered

type SelfDiscovered struct {
	SelfDiscovered bool `json:"selfDiscovered"`
}

type Status

type Status struct {
	Version string `json:"version"`
	Modules []struct {
		Name     string `json:"name"`
		Artifact string `json:"artifact"`
		Version  string `json:"version"`
	} `json:"modules"`
	Memory struct {
		MaxMemory    int `json:"maxMemory"`
		TotalMemory  int `json:"totalMemory"`
		FreeMemory   int `json:"freeMemory"`
		UsedMemory   int `json:"usedMemory"`
		DirectMemory int `json:"directMemory"`
	} `json:"memory"`
}

Jump to

Keyboard shortcuts

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