postgresql

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: Apache-2.0 Imports: 23 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// PackageName is the package name.
	PackageName = "go-postgresql"
	// DefaultPort is the default port for PostgreSQL protocol server.
	DefaultPort = 5432
)
View Source
const (
	Version = "1.5.2"
)

Variables

This section is empty.

Functions

func IsMatchQuery added in v1.3.0

func IsMatchQuery(q string, prefix string) bool

IsMatchQuery returns true if the query is matched with the prefix.

func IsPgbenchGetPartitionQuery added in v1.3.0

func IsPgbenchGetPartitionQuery(q string) bool

IsPgbenchGetPartitionQuery returns true if the query is pgbenchGetPartitionQuery.

func NewCopyCompleteResponsesFrom added in v1.3.0

func NewCopyCompleteResponsesFrom(q *query.Copy, stream *CopyStream, conn *Conn, schema *sql.Schema, queryExecutor QueryExecutor) (message.Responses, error)

NewCopyCompleteResponsesFrom returns a new copy complete response from the specified query.

func NewCopyInResponsesFrom added in v1.3.0

func NewCopyInResponsesFrom(q *query.Copy, schema *sql.Schema) (message.Responses, error)

NewCopyInResponsesFrom returns a new copy in response from the specified query.

func NewCopyQueryFrom added in v1.3.0

func NewCopyQueryFrom(schema *query.Schema, copyColumns sql.ColumnList, copyData *message.CopyData) (*query.Insert, error)

NewCopyQueryFrom returns a new copy query from the specified query.

func NewGetPartitionResponseForPgbench added in v1.3.0

func NewGetPartitionResponseForPgbench() (message.Responses, error)

NewGetPartitionResponseForPgbench returns a new response for pgbenchGetPartitionQuery.

func WithConnDatabase

func WithConnDatabase(name string) func(*Conn)

WithConnDatabase sets the database name.

func WithConnTracer

func WithConnTracer(t tracer.Context) func(*Conn)

WithConnDatabase sets the database name.

Types

type BaseAuthExecutor added in v1.4.0

type BaseAuthExecutor struct {
	*auth.AuthManager
}

BaseAuthExecutor represents a base authenticator.

func NewBaseAuthExecutor added in v1.4.0

func NewBaseAuthExecutor() *BaseAuthExecutor

NewBaseAuthExecutor returns a base authenticator.

func (*BaseAuthExecutor) Authenticate added in v1.4.0

func (executor *BaseAuthExecutor) Authenticate(conn *Conn, msg *message.Startup) (message.Response, error)

Authenticate authenticates the connection with the startup message.

type BaseBulkExecutor added in v1.0.0

type BaseBulkExecutor struct {
}

BaseBulkExecutor represents a base bulk message executor.

func NewBaseBulkExecutor added in v1.0.0

func NewBaseBulkExecutor() *BaseBulkExecutor

NewBaseBulkExecutor returns a base frontend message executor.

func (*BaseBulkExecutor) Copy added in v1.0.0

func (executor *BaseBulkExecutor) Copy(*Conn, *query.Copy) (message.Responses, error)

Copy handles a COPY query.

func (*BaseBulkExecutor) CopyData added in v1.3.0

func (executor *BaseBulkExecutor) CopyData(*Conn, *query.Copy, *CopyStream) (message.Responses, error)

Copy handles a COPY DATA message.

type BaseErrorHandler added in v1.1.0

type BaseErrorHandler struct {
}

BaseErrorHandler represents a base error handler.

func NewBaseErrorHandler added in v1.1.0

func NewBaseErrorHandler() *BaseErrorHandler

NewBaseErrorHandler returns a new BaseErrorHandler.

func (*BaseErrorHandler) ParserError added in v1.1.0

func (executor *BaseErrorHandler) ParserError(conn *Conn, q string, err error) (message.Responses, error)

ParserError handles a parser error.

type BaseExecutor

BaseExecutor represents a base frontend message executor.

func NewBaseExecutor

func NewBaseExecutor() *BaseExecutor

NewBaseExecutor returns a base frontend message executor.

func (*BaseExecutor) SetBulkExecutor added in v1.0.0

func (executor *BaseExecutor) SetBulkExecutor(be BulkExecutor)

SetBulkExecutor sets a user bulk executor.

func (*BaseExecutor) SetErrorHandler added in v1.1.0

func (executor *BaseExecutor) SetErrorHandler(eh ErrorHandler)

SetErrorHandler sets a user error handler.

func (*BaseExecutor) SetExtendedQueryExecutor added in v1.3.0

func (executor *BaseExecutor) SetExtendedQueryExecutor(eqe ExtendedQueryExecutor)

SetExtendedQueryExecutor sets a user extended query executor.

func (*BaseExecutor) SetQueryExecutor

func (executor *BaseExecutor) SetQueryExecutor(qe QueryExecutor)

SetQueryExecutor sets a user query executor.

func (*BaseExecutor) SetQueryExtraExecutor added in v1.2.0

func (executor *BaseExecutor) SetQueryExtraExecutor(qe QueryExtraExecutor)

SetQueryExtraExecutor sets a user query extra executor.

func (*BaseExecutor) SetStartupHandler added in v1.0.0

func (executor *BaseExecutor) SetStartupHandler(sh StartupHandler)

SetStartupHandler sets a user startup handler.

func (*BaseExecutor) SetSystemQueryExecutor added in v1.3.0

func (executor *BaseExecutor) SetSystemQueryExecutor(sq SystemQueryExecutor)

SetSystemQueryExecutor sets a system query executor.

func (*BaseExecutor) SetTransactionExecutor added in v1.2.0

func (executor *BaseExecutor) SetTransactionExecutor(te TCLExecutor)

SetTransactionExecutor sets a user transaction executor.

type BaseExtendedQueryExecutor added in v1.3.0

type BaseExtendedQueryExecutor struct {
	*BaseExecutor
}

BaseExtendedQueryExecutor represents a base extended query message executor.

func NewBaseExtendedQueryExecutorWith added in v1.3.0

func NewBaseExtendedQueryExecutorWith(executor *BaseExecutor) *BaseExtendedQueryExecutor

NewBaseExtendedQueryExecutorWith returns a base extended query message executor.

func (*BaseExtendedQueryExecutor) Bind added in v1.3.0

func (executor *BaseExtendedQueryExecutor) Bind(conn *Conn, msg *message.Bind) (message.Responses, error)

Bind handles a bind message.

func (*BaseExtendedQueryExecutor) Close added in v1.3.0

func (executor *BaseExtendedQueryExecutor) Close(conn *Conn, msg *message.Close) (message.Responses, error)

Close handles a close message.

func (*BaseExtendedQueryExecutor) Describe added in v1.3.0

func (executor *BaseExtendedQueryExecutor) Describe(conn *Conn, msg *message.Describe) (message.Responses, error)

Describe handles a describe message.

func (*BaseExtendedQueryExecutor) Execute added in v1.3.0

func (executor *BaseExtendedQueryExecutor) Execute(conn *Conn, msg *message.Execute) (message.Responses, error)

Execute handles a execute message.

func (*BaseExtendedQueryExecutor) Flush added in v1.3.0

func (executor *BaseExtendedQueryExecutor) Flush(conn *Conn, msg *message.Flush) (message.Responses, error)

Flush handles a flush message.

func (*BaseExtendedQueryExecutor) Parse added in v1.3.0

func (executor *BaseExtendedQueryExecutor) Parse(conn *Conn, msg *message.Parse) (message.Responses, error)

Prepare handles a parse message.

func (*BaseExtendedQueryExecutor) Query added in v1.3.0

func (executor *BaseExtendedQueryExecutor) Query(conn *Conn, msg *message.Query) (message.Responses, error)

Query handles a query message.

func (*BaseExtendedQueryExecutor) Sync added in v1.3.0

func (executor *BaseExtendedQueryExecutor) Sync(conn *Conn, msg *message.Sync) (message.Responses, error)

Sync handles a sync message.

type BaseQueryExecutor

type BaseQueryExecutor struct {
}

BaseQueryExecutor represents a base query message executor.

func NewBaseQueryExecutor

func NewBaseQueryExecutor() *BaseQueryExecutor

NewBaseQueryExecutor returns a base frontend message executor.

func (*BaseQueryExecutor) AlterDatabase added in v1.2.0

func (executor *BaseQueryExecutor) AlterDatabase(*Conn, *query.AlterDatabase) (message.Responses, error)

AlterDatabase handles a ALTER DATABASE query.

func (*BaseQueryExecutor) AlterTable added in v1.2.0

func (executor *BaseQueryExecutor) AlterTable(*Conn, *query.AlterTable) (message.Responses, error)

AlterTable handles a ALTER TABLE query.

func (*BaseQueryExecutor) CreateDatabase

func (executor *BaseQueryExecutor) CreateDatabase(*Conn, *query.CreateDatabase) (message.Responses, error)

CreateDatabase handles a CREATE DATABASE query.

func (*BaseQueryExecutor) CreateTable

func (executor *BaseQueryExecutor) CreateTable(*Conn, *query.CreateTable) (message.Responses, error)

CreateTable handles a CREATE TABLE query.

func (*BaseQueryExecutor) Delete

func (executor *BaseQueryExecutor) Delete(*Conn, *query.Delete) (message.Responses, error)

Delete handles a DELETE query.

func (*BaseQueryExecutor) DropDatabase

func (executor *BaseQueryExecutor) DropDatabase(*Conn, *query.DropDatabase) (message.Responses, error)

DropDatabase handles a DROP DATABASE query.

func (*BaseQueryExecutor) DropTable

func (executor *BaseQueryExecutor) DropTable(*Conn, *query.DropTable) (message.Responses, error)

DropIndex handles a DROP INDEX query.

func (*BaseQueryExecutor) Insert

func (executor *BaseQueryExecutor) Insert(*Conn, *query.Insert) (message.Responses, error)

Insert handles a INSERT query.

func (*BaseQueryExecutor) Select

func (executor *BaseQueryExecutor) Select(*Conn, *query.Select) (message.Responses, error)

Select handles a SELECT query.

func (*BaseQueryExecutor) Update

func (executor *BaseQueryExecutor) Update(*Conn, *query.Update) (message.Responses, error)

Update handles a UPDATE query.

type BaseStartupExecutor added in v1.4.0

type BaseStartupExecutor struct {
	*BaseAuthExecutor
	// contains filtered or unexported fields
}

BaseStartupExecutor represents a base frontend message executor.

func NewBaseProtocolExecutor

func NewBaseProtocolExecutor() *BaseStartupExecutor

NewBaseProtocolExecutor returns a base frontend message executor.

func (*BaseStartupExecutor) BackendKeyData added in v1.4.0

func (executor *BaseStartupExecutor) BackendKeyData(*Conn) (message.Response, error)

BackendKeyData returns the backend key data.

func (*BaseStartupExecutor) ParameterStatuses added in v1.4.0

func (executor *BaseStartupExecutor) ParameterStatuses(*Conn) (message.Responses, error)

ParameterStatuses returns the parameter statuses.

type BaseSugarExecutor added in v1.2.1

type BaseSugarExecutor struct {
	*BaseExecutor
}

BaseSugarExecutor represents a base sugar query executor.

func NewBaseSugarExecutorWith added in v1.2.1

func NewBaseSugarExecutorWith(executor *BaseExecutor) *BaseSugarExecutor

NewBaseSugarExecutor returns a base sugar query executor.

func (*BaseSugarExecutor) Truncate added in v1.2.1

func (executor *BaseSugarExecutor) Truncate(conn *Conn, stmt *query.Truncate) (message.Responses, error)

Truncate handles a TRUNCATE query.

func (*BaseSugarExecutor) Vacuum added in v1.2.1

func (executor *BaseSugarExecutor) Vacuum(conn *Conn, stmt *query.Vacuum) (message.Responses, error)

Vacuum handles a VACUUM query.

type BaseSystemQueryExecutor added in v1.3.0

type BaseSystemQueryExecutor struct {
}

BaseSystemQueryExecutor represents a base query message executor.

func NewBaseSystemQueryExecutor added in v1.3.0

func NewBaseSystemQueryExecutor() *BaseSystemQueryExecutor

NewBaseSystemQueryExecutor returns a base frontend message executor.

func (*BaseSystemQueryExecutor) SystemSelect added in v1.3.0

func (executor *BaseSystemQueryExecutor) SystemSelect(*Conn, *query.Select) (message.Responses, error)

SystemSelect handles a SELECT query for system tables.

type BaseTransactionExecutor added in v1.2.0

type BaseTransactionExecutor struct {
}

BaseTransactionExecutor represents a base bulk message executor.

func NewBaseTransactionExecutor added in v1.2.0

func NewBaseTransactionExecutor() *BaseTransactionExecutor

NewBaseTransactionExecutor returns a base frontend message executor.

func (*BaseTransactionExecutor) Begin added in v1.2.0

Begin handles a BEGIN query.

func (*BaseTransactionExecutor) Commit added in v1.2.0

Commit handles a COMMIT query.

func (*BaseTransactionExecutor) Rollback added in v1.2.0

func (executor *BaseTransactionExecutor) Rollback(*Conn, *query.Rollback) (message.Responses, error)

Rollback handles a ROLLBACK query.

type BulkExecutor added in v0.9.1

type BulkExecutor interface {
	// Copy handles a COPY query.
	Copy(*Conn, *query.Copy) (message.Responses, error)
	// CopyData handles a COPY data message.
	CopyData(*Conn, *query.Copy, *CopyStream) (message.Responses, error)
}

BulkExecutor defines a executor interface for bulk operations.

type Config

type Config struct {
	*TLSConf
	// contains filtered or unexported fields
}

Config stores server configuration parammeters.

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig returns a default configuration instance.

func (*Config) Address added in v1.0.0

func (config *Config) Address() string

Address returns a listen address from the configuration.

func (*Config) Port

func (config *Config) Port() int

Port returns a listen port from the configuration.

func (*Config) SetAddress added in v1.0.0

func (config *Config) SetAddress(addr string)

SetAddress sets a listen address to the configuration.

func (*Config) SetPort

func (config *Config) SetPort(port int)

SetPort sets a listen port to the configuration.

type Conn

type Conn struct {
	net.Conn

	tracer.Context
	PreparedStatementMap
	PreparedPortalMap
	// contains filtered or unexported fields
}

Conn represents a connection of PostgreSQL binary protocol.

func NewConnWith

func NewConnWith(netConn net.Conn, opts ...ConnOption) *Conn

NewConnWith returns a connection with a raw connection.

func (*Conn) Database added in v1.0.0

func (conn *Conn) Database() string

Database returns the database name.

func (*Conn) MessageReader added in v1.4.0

func (conn *Conn) MessageReader() *message.MessageReader

MessageReader returns a message reader.

func (*Conn) ReadyForMessage added in v1.3.0

func (conn *Conn) ReadyForMessage(status message.TransactionStatus) error

ReadyForMessage sends a ready for message.

func (*Conn) ResponseError added in v1.3.0

func (conn *Conn) ResponseError(err error) error

ResponseError sends an error response.

func (*Conn) ResponseMessage added in v1.3.0

func (conn *Conn) ResponseMessage(resMsg message.Response) error

ResponseMessage sends a response message.

func (*Conn) ResponseMessages added in v1.3.0

func (conn *Conn) ResponseMessages(resMsgs message.Responses) error

ResponseMessages sends response messages.

func (*Conn) SetDatabase added in v1.0.0

func (conn *Conn) SetDatabase(db string)

SetDatabase sets the database name.

func (*Conn) SetSpanContext added in v1.3.0

func (conn *Conn) SetSpanContext(ctx tracer.Context)

SetSpanContext sets the tracer span context of the connection.

func (*Conn) SkipMessage added in v1.3.0

func (conn *Conn) SkipMessage() error

SkipMessage skips a message.

func (*Conn) SpanContext

func (conn *Conn) SpanContext() tracer.Context

SpanContext returns the tracer span context of the connection.

func (*Conn) Timestamp

func (conn *Conn) Timestamp() time.Time

Timestamp returns the creation time of the connection.

func (*Conn) UUID added in v1.3.3

func (conn *Conn) UUID() uuid.UUID

UUID returns the UUID of the connection.

type ConnOption

type ConnOption = func(*Conn)

ConnOption represents a connection option.

type CopyStream added in v0.9.1

type CopyStream struct {
	*message.MessageReader
}

CopyStream represents a copy stream.

func NewCopyStreamWithReader added in v0.9.1

func NewCopyStreamWithReader(reader *message.MessageReader) *CopyStream

NewCopyStreamWithReader returns a new copy stream with the specified reader.

func (*CopyStream) Next added in v0.9.1

func (stream *CopyStream) Next() (*message.CopyData, error)

Next returns true if the next message is available.

type DDOExecutor

type DDOExecutor interface {
	// CreateDatabase handles a CREATE DATABASE query.
	CreateDatabase(*Conn, *query.CreateDatabase) (message.Responses, error)
	// CreateTable handles a CREATE TABLE query.
	CreateTable(*Conn, *query.CreateTable) (message.Responses, error)
	// AlterDatabase handles a ALTER DATABASE query.
	AlterDatabase(*Conn, *query.AlterDatabase) (message.Responses, error)
	// AlterTable handles a ALTER TABLE query.
	AlterTable(*Conn, *query.AlterTable) (message.Responses, error)
	// DropDatabase handles a DROP DATABASE query.
	DropDatabase(*Conn, *query.DropDatabase) (message.Responses, error)
	// DropIndex handles a DROP INDEX query.
	DropTable(*Conn, *query.DropTable) (message.Responses, error)
}

DDOExecutor defines a executor interface for DDO (Data Definition Operations).

type DMOExecutor

type DMOExecutor interface {
	// Insert handles a INSERT query.
	Insert(*Conn, *query.Insert) (message.Responses, error)
	// Select handles a SELECT query.
	Select(*Conn, *query.Select) (message.Responses, error)
	// Update handles a UPDATE query.
	Update(*Conn, *query.Update) (message.Responses, error)
	// Delete handles a DELETE query.
	Delete(*Conn, *query.Delete) (message.Responses, error)
}

DMOExecutor defines a executor interface for DMO (Data Manipulation Operations).

type DMOExtraExecutor added in v1.2.0

type DMOExtraExecutor interface {
	// Vacuum handles a VACUUM query.
	Vacuum(*Conn, *query.Vacuum) (message.Responses, error)
	// Truncate handles a TRUNCATE query.
	Truncate(*Conn, *query.Truncate) (message.Responses, error)
}

DMOExtraExecutor defines a executor interface for DMO (Data Manipulation Operations).

type ErrorHandler added in v1.1.0

type ErrorHandler interface {
	ParserError(*Conn, string, error) (message.Responses, error)
}

ErrorHandler represents a user error handler.

type Executor

type Executor interface {
	StartupHandler
	QueryExecutor
	QueryExtraExecutor
	TCLExecutor
	ExtendedQueryExecutor
	SystemQueryExecutor
	BulkExecutor
	ErrorHandler
	// SetStartupHandler sets a user startup handler.
	SetStartupHandler(StartupHandler)
	// SetQueryExecutor sets a user query executor.
	SetQueryExecutor(QueryExecutor)
	// SetQueryExecutor sets a user query executor.
	SetQueryExtraExecutor(QueryExtraExecutor)
	// SetTransactionExecutor sets a user transaction executor.
	SetTransactionExecutor(TCLExecutor)
	// SetSystemQueryExecutor sets a system query executor.
	SetSystemQueryExecutor(SystemQueryExecutor)
	// SetBulkExecutor sets a user bulk executor.
	SetBulkExecutor(BulkExecutor)
	// SetErrorHandler sets a user error handler.
	SetErrorHandler(ErrorHandler)
}

Executor represents a frontend message executor.

type ExtendedQueryExecutor added in v1.3.0

type ExtendedQueryExecutor interface {
	// Query handles a query message.
	Query(*Conn, *message.Query) (message.Responses, error)
	// Prepare handles a parse message.
	Parse(*Conn, *message.Parse) (message.Responses, error)
	// Bind handles a bind message.
	Bind(*Conn, *message.Bind) (message.Responses, error)
	// Describe handles a describe message.
	Describe(*Conn, *message.Describe) (message.Responses, error)
	// Execute handles a execute message.
	Execute(*Conn, *message.Execute) (message.Responses, error)
	// Close handles a close message.
	Close(*Conn, *message.Close) (message.Responses, error)
	// Sync handles a sync message.
	Sync(*Conn, *message.Sync) (message.Responses, error)
	// Flush handles a flush message.
	Flush(*Conn, *message.Flush) (message.Responses, error)
}

ExtendedQueryExecutor defines a executor interface for extended query operations.

type PreparedPortal added in v1.3.0

type PreparedPortal = message.Query

PreparedPortal represents a prepared query statement.

type PreparedPortalMap added in v1.3.0

type PreparedPortalMap map[string]PreparedPortal

PreparedPortalMap represents a prepared query statement map.

func NewPreparedPortalMap added in v1.3.0

func NewPreparedPortalMap() PreparedPortalMap

NewPreparedPortalMap returns a new prepared query statement map.

func (PreparedPortalMap) PreparedPortal added in v1.3.0

func (portalMap PreparedPortalMap) PreparedPortal(name string) (*PreparedPortal, error)

PreparedPortal returns a prepared query statement.

func (PreparedPortalMap) RemovePreparedPortal added in v1.3.0

func (portalMap PreparedPortalMap) RemovePreparedPortal(name string) error

RemovePreparedPortal removes a prepared query statement.

func (PreparedPortalMap) SetPreparedPortal added in v1.3.0

func (portalMap PreparedPortalMap) SetPreparedPortal(name string, query *PreparedPortal) error

SetPreparedPortal sets a prepared query statement.

type PreparedStatement added in v1.3.0

type PreparedStatement struct {
	*message.Parse
	ParsedStatement *query.Statement
}

PreparedStatement represents a prepared statement.

func (*PreparedStatement) Name added in v1.3.0

func (stmt *PreparedStatement) Name() string

Name returns a prepared statement name.

type PreparedStatementMap added in v1.3.0

type PreparedStatementMap map[string]*PreparedStatement

PreparedStatementMap represents a prepared statement map.

func NewPreparedStatementMap added in v1.3.0

func NewPreparedStatementMap() PreparedStatementMap

NewPreparedStatementMap returns a new prepared statement map.

func (PreparedStatementMap) PreparedStatement added in v1.3.0

func (stmtMap PreparedStatementMap) PreparedStatement(name string) (*PreparedStatement, error)

PreparedStatement returns a prepared statement.

func (PreparedStatementMap) RemovePreparedStatement added in v1.3.0

func (stmtMap PreparedStatementMap) RemovePreparedStatement(name string) error

RemovePreparedStatement removes a prepared statement.

func (PreparedStatementMap) SetPreparedStatement added in v1.3.0

func (stmtMap PreparedStatementMap) SetPreparedStatement(msg *message.Parse) error

SetPreparedStatement sets a prepared statement.

type QueryExecutor

type QueryExecutor interface {
	DDOExecutor
	DMOExecutor
}

QueryExecutor represents a user query message executor.

type QueryExtraExecutor added in v1.2.0

type QueryExtraExecutor interface {
	DMOExtraExecutor
}

QueryExtraExecutor represents a user query message executor.

type Server

type Server struct {
	*Config
	tracer.Tracer

	Executor
	// contains filtered or unexported fields
}

Server represents a PostgreSQL protocol server.

func NewServer

func NewServer() *Server

NewServer returns a new server instance.

func (*Server) Restart

func (server *Server) Restart() error

Restart restarts the server.

func (*Server) SetTracer

func (server *Server) SetTracer(t tracer.Tracer)

SetTracer sets a tracing tracer.

func (*Server) Start

func (server *Server) Start() error

Start starts the server.

func (*Server) Stop

func (server *Server) Stop() error

Stop stops the server.

type StartupAuthHandler added in v1.4.0

type StartupAuthHandler interface {
	// Authenticate handles the Start-up message and returns an Authentication or ErrorResponse message.
	Authenticate(*Conn, *message.Startup) (message.Response, error)
	// AddAuthenticator adds a new authenticator.
	AddAuthenticator(auth.Authenticator)
	// ClearAuthenticators clears all authenticators.
	ClearAuthenticators()
}

StartupAuthHandler represents a start-up authenticatation handler.

type StartupHandler added in v1.0.0

type StartupHandler interface {
	StartupAuthHandler
	// ParameterStatuses returns the parameter statuses.
	ParameterStatuses(*Conn) (message.Responses, error)
	// BackendKeyData returns the backend key data.
	BackendKeyData(*Conn) (message.Response, error)
}

StartupAuthHandler represents a start-up message handler.

type SystemQueryExecutor added in v1.3.0

type SystemQueryExecutor interface {
	// SystemSelect handles a SELECT query for system tables.
	SystemSelect(*Conn, *query.Select) (message.Responses, error)
}

SystemQueryExecutor represents a system query message executor.

type TCLExecutor added in v1.3.4

type TCLExecutor interface {
	// Begin handles a BEGIN query.
	Begin(*Conn, *query.Begin) (message.Responses, error)
	// Commit handles a COMMIT query.
	Commit(*Conn, *query.Commit) (message.Responses, error)
	// Rollback handles a ROLLBACK query.
	Rollback(*Conn, *query.Rollback) (message.Responses, error)
}

TCLExecutor defines a executor interface for TCL (Transaction Control Language).

type TLSConf added in v1.5.0

type TLSConf struct {
	ClientAuthType tls.ClientAuthType
	ServerCert     []byte
	ServerKey      []byte
	RootCerts      [][]byte
	// contains filtered or unexported fields
}

TLSConf represents a TLS configuration.

func NewTLSConf added in v1.5.0

func NewTLSConf() *TLSConf

NewTLSConf returns a new TLS configuration.

func (*TLSConf) IsTLSEnabled added in v1.5.1

func (config *TLSConf) IsTLSEnabled() bool

IsEnabled returns true if the TLS is enabled.

func (*TLSConf) SetClientAuthType added in v1.5.0

func (config *TLSConf) SetClientAuthType(authType tls.ClientAuthType)

SetClientAuthType sets a client authentication type.

func (*TLSConf) SetRootCertFiles added in v1.5.0

func (config *TLSConf) SetRootCertFiles(files ...string) error

SetRootCertFile sets a SSL root certificates.

func (*TLSConf) SetRootCerts added in v1.5.2

func (config *TLSConf) SetRootCerts(certs ...[]byte)

SetRootCerts sets a SSL root certificates.

func (*TLSConf) SetServerCert added in v1.5.2

func (config *TLSConf) SetServerCert(cert []byte)

SetServerCert sets a SSL server certificate.

func (*TLSConf) SetServerCertFile added in v1.5.0

func (config *TLSConf) SetServerCertFile(file string) error

SetServerCertFile sets a SSL server certificate file.

func (*TLSConf) SetServerKey added in v1.5.2

func (config *TLSConf) SetServerKey(key []byte)

SetServerKey sets a SSL server key.

func (*TLSConf) SetServerKeyFile added in v1.5.0

func (config *TLSConf) SetServerKeyFile(file string) error

SetServerKeyFile sets a SSL server key file.

func (*TLSConf) SetTLSConfig added in v1.5.2

func (config *TLSConf) SetTLSConfig(tlsConfig *tls.Config)

SetTLSConfig sets a TLS configuration.

func (*TLSConf) SetTLSEnabled added in v1.5.1

func (config *TLSConf) SetTLSEnabled(enabled bool)

SetTLSEnabled sets a TLS enabled flag.

func (*TLSConf) TLSConfig added in v1.5.0

func (config *TLSConf) TLSConfig() (*tls.Config, error)

TLSConfig returns a TLS configuration from the configuration.

Directories

Path Synopsis
encoding

Jump to

Keyboard shortcuts

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