client

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnectStatusConnecting = iota
	ConnectStatusConnected
	ConnectStatusDisconnected
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BindExecResponse

type BindExecResponse struct {
	DataRows   []*frame.DataRow
	Completion *frame.CommandCompletion
}

type Client

type Client struct {
	Dsn DataSourceName // 数据源

	Location *time.Location // 服务器端的时区

	ConnectStatus ConnectStatus // 连接状态
	// contains filtered or unexported fields
}

func NewClient

func NewClient() (c *Client)

func (*Client) AutoSSL

func (c *Client) AutoSSL() (err error)

AutoSSL 按配置中的严格程度开始TLS握手

func (*Client) BindExec

func (c *Client) BindExec(name string, args []driver.Value) (res BindExecResponse, err error)

func (*Client) CancelRequest

func (c *Client) CancelRequest() (err error)

CancelRequest 建立新连接,使用PID+口令从新连接中发出指令

func (*Client) CloseParse

func (c *Client) CloseParse(name string) (err error)

func (*Client) Connect

func (c *Client) Connect(ctx context.Context, dsn DataSourceName) (err error)

func (*Client) GetNotification

func (c *Client) GetNotification() (pid uint32, channel, message string, err error)

func (*Client) IsInTransaction

func (c *Client) IsInTransaction() bool

func (*Client) Listen

func (c *Client) Listen(channel string) (err error)

func (*Client) Parse

func (c *Client) Parse(name, query string) (res ParseResponse, err error)

func (*Client) QueryNoArgs

func (c *Client) QueryNoArgs(query string) (res SimpleQueryResponse, err error)

func (*Client) Startup

func (c *Client) Startup() (err error)

Startup 启动

func (*Client) Terminate

func (c *Client) Terminate() (err error)

func (*Client) TestConn

func (c *Client) TestConn() ([]byte, error)

type ConnectStatus

type ConnectStatus int

type DataSourceName

type DataSourceName struct {
	Host           string
	Port           string
	Password       string
	ConnectTimeout time.Duration
	Parameter      map[string]string
	SSL            struct {
		Mode        string
		Cert        string
		Key         string
		RootCert    string
		Crl         string
		Compression int
	}
}

func ParseDSN

func ParseDSN(connectStr string) (dsn DataSourceName, err error)

func (*DataSourceName) Address

func (dsn *DataSourceName) Address() (network, address string, timeout time.Duration)

func (*DataSourceName) SSLCheck

func (dsn *DataSourceName) SSLCheck() (err error)

type NotificationHandler

type NotificationHandler func(pid uint32, channel, message string)

type ParseResponse

type ParseResponse struct {
	Parameters *frame.ParameterDescription
	Rows       *frame.RowDescription
}

type SimpleQueryResponse

type SimpleQueryResponse struct {
	ParseResponse
	BindExecResponse
}

Directories

Path Synopsis
Package scram implements a SCRAM-{SHA-1,etc} client per RFC5802.
Package scram implements a SCRAM-{SHA-1,etc} client per RFC5802.

Jump to

Keyboard shortcuts

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