client

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientMethod contextKey = iota
)

Variables

View Source
var ErrNotImplemented = errors.New("databricks: not implemented")
View Source
var RecordResults bool

RecordResults is used to generate test data. Developer should change this manually

Functions

func CheckStatus

func CheckStatus(resp interface{}) error

CheckStatus checks the status code after a thrift operation. Returns nil if the operation is successful or still executing, otherwise returns an error.

func LoggerAndContext added in v1.5.1

func LoggerAndContext(ctx context.Context, c any) (*logger.DBSQLLogger, context.Context)

Create an updated context and a logger that includes query and connection id

func PooledClient added in v1.1.0

func PooledClient(cfg *config.Config) *http.Client

func PooledTransport added in v1.1.0

func PooledTransport(cfg *config.Config) *http.Transport

func RetryPolicy added in v1.1.0

func RetryPolicy(ctx context.Context, resp *http.Response, err error) (bool, error)

func RetryableClient added in v1.1.0

func RetryableClient(cfg *config.Config) *http.Client

func SprintGuid

func SprintGuid(bts []byte) string

SprintGuid is a convenience function to format a byte array into GUID.

Types

type TestClient

type TestClient struct {
	FnOpenSession           func(ctx context.Context, req *cli_service.TOpenSessionReq) (_r *cli_service.TOpenSessionResp, _err error)
	FnCloseSession          func(ctx context.Context, req *cli_service.TCloseSessionReq) (_r *cli_service.TCloseSessionResp, _err error)
	FnGetInfo               func(ctx context.Context, req *cli_service.TGetInfoReq) (_r *cli_service.TGetInfoResp, _err error)
	FnExecuteStatement      func(ctx context.Context, req *cli_service.TExecuteStatementReq) (_r *cli_service.TExecuteStatementResp, _err error)
	FnGetTypeInfo           func(ctx context.Context, req *cli_service.TGetTypeInfoReq) (_r *cli_service.TGetTypeInfoResp, _err error)
	FnGetCatalogs           func(ctx context.Context, req *cli_service.TGetCatalogsReq) (_r *cli_service.TGetCatalogsResp, _err error)
	FnGetSchemas            func(ctx context.Context, req *cli_service.TGetSchemasReq) (_r *cli_service.TGetSchemasResp, _err error)
	FnGetTables             func(ctx context.Context, req *cli_service.TGetTablesReq) (_r *cli_service.TGetTablesResp, _err error)
	FnGetTableTypes         func(ctx context.Context, req *cli_service.TGetTableTypesReq) (_r *cli_service.TGetTableTypesResp, _err error)
	FnGetColumns            func(ctx context.Context, req *cli_service.TGetColumnsReq) (_r *cli_service.TGetColumnsResp, _err error)
	FnGetFunctions          func(ctx context.Context, req *cli_service.TGetFunctionsReq) (_r *cli_service.TGetFunctionsResp, _err error)
	FnGetPrimaryKeys        func(ctx context.Context, req *cli_service.TGetPrimaryKeysReq) (_r *cli_service.TGetPrimaryKeysResp, _err error)
	FnGetCrossReference     func(ctx context.Context, req *cli_service.TGetCrossReferenceReq) (_r *cli_service.TGetCrossReferenceResp, _err error)
	FnGetOperationStatus    func(ctx context.Context, req *cli_service.TGetOperationStatusReq) (_r *cli_service.TGetOperationStatusResp, _err error)
	FnCancelOperation       func(ctx context.Context, req *cli_service.TCancelOperationReq) (_r *cli_service.TCancelOperationResp, _err error)
	FnCloseOperation        func(ctx context.Context, req *cli_service.TCloseOperationReq) (_r *cli_service.TCloseOperationResp, _err error)
	FnGetResultSetMetadata  func(ctx context.Context, req *cli_service.TGetResultSetMetadataReq) (_r *cli_service.TGetResultSetMetadataResp, _err error)
	FnFetchResults          func(ctx context.Context, req *cli_service.TFetchResultsReq) (_r *cli_service.TFetchResultsResp, _err error)
	FnGetDelegationToken    func(ctx context.Context, req *cli_service.TGetDelegationTokenReq) (_r *cli_service.TGetDelegationTokenResp, _err error)
	FnCancelDelegationToken func(ctx context.Context, req *cli_service.TCancelDelegationTokenReq) (_r *cli_service.TCancelDelegationTokenResp, _err error)
	FnRenewDelegationToken  func(ctx context.Context, req *cli_service.TRenewDelegationTokenReq) (_r *cli_service.TRenewDelegationTokenResp, _err error)
}

func (*TestClient) CancelDelegationToken

func (*TestClient) CancelOperation

func (*TestClient) CloseOperation

func (*TestClient) CloseSession

func (*TestClient) ExecuteStatement

func (*TestClient) FetchResults

func (*TestClient) GetCatalogs

func (*TestClient) GetColumns

func (*TestClient) GetCrossReference

func (*TestClient) GetDelegationToken

func (*TestClient) GetFunctions

func (*TestClient) GetInfo

func (c *TestClient) GetInfo(ctx context.Context, req *cli_service.TGetInfoReq) (_r *cli_service.TGetInfoResp, _err error)

func (*TestClient) GetOperationStatus

func (*TestClient) GetPrimaryKeys

func (*TestClient) GetResultSetMetadata

func (*TestClient) GetSchemas

func (*TestClient) GetTableTypes

func (*TestClient) GetTables

func (c *TestClient) GetTables(ctx context.Context, req *cli_service.TGetTablesReq) (_r *cli_service.TGetTablesResp, _err error)

func (*TestClient) GetTypeInfo

func (*TestClient) OpenSession

func (*TestClient) RenewDelegationToken

type ThriftResponse

type ThriftResponse interface {
	GetStatus() *cli_service.TStatus
}

ThriftResponse represents the thrift rpc response

type ThriftServiceClient

type ThriftServiceClient struct {
	*cli_service.TCLIServiceClient
}

func InitThriftClient

func InitThriftClient(cfg *config.Config, httpclient *http.Client) (*ThriftServiceClient, error)

InitThriftClient is a wrapper of the http transport, so we can have access to response code and headers. It is important to know the code and headers to know if we need to retry or not

func (*ThriftServiceClient) CancelOperation

CancelOperation is a wrapper around the thrift operation CancelOperation If RecordResults is true, the results will be marshalled to JSON format and written to CancelOperation<index>.json

func (*ThriftServiceClient) CloseOperation

CloseOperation is a wrapper around the thrift operation CloseOperation If RecordResults is true, the results will be marshalled to JSON format and written to CloseOperation<index>.json

func (*ThriftServiceClient) CloseSession

CloseSession is a wrapper around the thrift operation CloseSession If RecordResults is true, the results will be marshalled to JSON format and written to CloseSession<index>.json

func (*ThriftServiceClient) ExecuteStatement

ExecuteStatement is a wrapper around the thrift operation ExecuteStatement If RecordResults is true, the results will be marshalled to JSON format and written to ExecuteStatement<index>.json

func (*ThriftServiceClient) FetchResults

FetchResults is a wrapper around the thrift operation FetchResults If RecordResults is true, the results will be marshalled to JSON format and written to FetchResults<index>.json

func (*ThriftServiceClient) GetOperationStatus

GetOperationStatus is a wrapper around the thrift operation GetOperationStatus If RecordResults is true, the results will be marshalled to JSON format and written to GetOperationStatus<index>.json

func (*ThriftServiceClient) GetResultSetMetadata

GetResultSetMetadata is a wrapper around the thrift operation GetResultSetMetadata If RecordResults is true, the results will be marshalled to JSON format and written to GetResultSetMetadata<index>.json

func (*ThriftServiceClient) OpenSession

OpenSession is a wrapper around the thrift operation OpenSession If RecordResults is true, the results will be marshalled to JSON format and written to OpenSession<index>.json

type Transport

type Transport struct {
	Base  http.RoundTripper
	Authr auth.Authenticator
	// contains filtered or unexported fields
}

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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