conn

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 18 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAsyncErrorNotFound

func IsAsyncErrorNotFound(err error) bool

func IsAsyncJobInProgress

func IsAsyncJobInProgress(err error) (string, bool)

func NewAsyncConnection

func NewAsyncConnection(c driver.Connection) driver.Connection

func NewClosedConnection

func NewClosedConnection() driver.Connection

func NewContextDialer

func NewContextDialer(connectionWrapper TransportConnWrap) proxy.ContextDialer

NewContextDialer returns dialer which wraps existing connection with a network connection wrapper.

func WithAsyncID

func WithAsyncID(ctx context.Context, id string) context.Context

Types

type Auth

type Auth func() (driver.Authentication, error)

type Config

type Config func() (http.ConnectionConfig, error)

type Connection

type Connection interface {
	Execute(ctx context.Context, method string, endpoint string, body io.Reader) (io.ReadCloser, int, error)
}

func NewConnection

func NewConnection(c ConnectionConfig) Connection

type ConnectionConfig

type ConnectionConfig struct {
	// host is address to a server.
	Host string
	// auth is a pure jwt bearer token: "bearer <jwt_token>"
	Auth *string
	// ConnWrapper wraps original network connection with an additional functionality provided by a caller.
	ConnWrapper TransportConnWrap
}

ConnectionConfig describes how connection can be created.

type ConnectionWrap

type ConnectionWrap func(c driver.Connection) driver.Connection

type ContextKey

type ContextKey string

type Executor

type Executor[IN, OUT interface{}] interface {
	ExecuteGet(ctx context.Context, endpoint string) (*OUT, int, error)
	Execute(ctx context.Context, method string, endpoint string, in IN) (*OUT, int, error)
}

func NewExecutor

func NewExecutor[IN, OUT interface{}](conn Connection) Executor[IN, OUT]

type Factory

type Factory interface {
	Connection(hosts ...string) (driver.Connection, error)
	AgencyConnection(hosts ...string) (driver.Connection, error)

	Client(hosts ...string) (driver.Client, error)
	Agency(hosts ...string) (agency.Agency, error)

	RawConnection(host string) (Connection, error)

	GetAuth() Auth
}

func NewFactory

func NewFactory(auth Auth, config Config) Factory

type TransportConnWrap

type TransportConnWrap func(net.Conn) net.Conn

TransportConnWrap instructs how to wrap net.Conn connection.

Jump to

Keyboard shortcuts

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