Documentation ¶
Index ¶
- Constants
- type ConnManager
- type PGConn
- func (conn *PGConn) PostgresVersion() int
- func (conn *PGConn) Query(ctx context.Context, query string, args ...interface{}) (rows *sql.Rows, err error)
- func (conn *PGConn) QueryByName(ctx context.Context, queryName string, args ...interface{}) (rows *sql.Rows, err error)
- func (conn *PGConn) QueryRow(ctx context.Context, query string, args ...interface{}) (row *sql.Row, err error)
- func (conn *PGConn) QueryRowByName(ctx context.Context, queryName string, args ...interface{}) (row *sql.Row, err error)
- type Plugin
- type PluginOptions
- type PostgresClient
- type PostgresURIValidator
- type Session
Constants ¶
const (
MinSupportedPGVersion = 100000
)
const (
Name = "PostgreSQL"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnManager ¶
type ConnManager struct { sync.Mutex Destroy context.CancelFunc // contains filtered or unexported fields }
ConnManager is a thread-safe structure for manage connections.
func NewConnManager ¶
func NewConnManager(keepAlive, connectTimeout, callTimeout, hkInterval time.Duration, queryStorage yarn.Yarn) *ConnManager
NewConnManager initializes connManager structure and runs Go Routine that watches for unused connections.
type PGConn ¶
type PGConn struct {
// contains filtered or unexported fields
}
PGConn holds pointer to the Pool of PostgreSQL Instance.
func (*PGConn) PostgresVersion ¶
PostgresVersion returns the version of PostgreSQL server we are currently connected to.
func (*PGConn) Query ¶
func (conn *PGConn) Query(ctx context.Context, query string, args ...interface{}) (rows *sql.Rows, err error)
Query wraps pgxpool.Query.
func (*PGConn) QueryByName ¶
func (conn *PGConn) QueryByName(ctx context.Context, queryName string, args ...interface{}) (rows *sql.Rows, err error)
QueryByName executes a query from queryStorage by its name and returns a single row.
type Plugin ¶
Plugin inherits plugin.Base and store plugin-specific data.
var Impl Plugin
Impl is the pointer to the plugin implementation.
func (*Plugin) Configure ¶
func (p *Plugin) Configure(global *plugin.GlobalOptions, options interface{})
Configure implements the Configurator interface. Initializes configuration structures.
func (*Plugin) Export ¶
func (p *Plugin) Export(key string, rawParams []string, _ plugin.ContextProvider) (result any, err error)
Export implements the Exporter interface.
func (*Plugin) Start ¶
func (p *Plugin) Start()
Start implements the Runner interface and performs initialization when plugin is activated.
type PluginOptions ¶
type PluginOptions struct { plugin.SystemOptions `conf:"optional,name=System"` // Timeout is the maximum time in seconds for waiting when a connection has to be established. // Default value equals to the global agent timeout. Timeout int `conf:"optional,range=1:30"` // CallTimeout is the maximum time in seconds for waiting when a request has to be done. // Default value equals to the global agent timeout. CallTimeout int `conf:"optional,range=1:30"` // KeepAlive is a time to wait before unused connections will be closed. KeepAlive int `conf:"optional,range=60:900,default=300"` // Sessions stores pre-defined named sets of connections settings. Sessions map[string]Session `conf:"optional"` // CustomQueriesPath is a full pathname of a directory containing *.sql files with custom queries. CustomQueriesPath string `conf:"optional"` // Default stores default connection parameter values from configuration file Default Session `conf:"optional"` }
PluginOptions are options for PostgreSQL connection.
type PostgresClient ¶
type PostgresClient interface { Query(ctx context.Context, query string, args ...interface{}) (rows *sql.Rows, err error) QueryByName(ctx context.Context, queryName string, args ...interface{}) (rows *sql.Rows, err error) QueryRow(ctx context.Context, query string, args ...interface{}) (row *sql.Row, err error) QueryRowByName(ctx context.Context, queryName string, args ...interface{}) (row *sql.Row, err error) PostgresVersion() int }
type PostgresURIValidator ¶
func (PostgresURIValidator) Validate ¶
func (v PostgresURIValidator) Validate(value *string) error
type Session ¶
type Session struct { // URI is a connection string consisting of a network scheme, a host address and a port or a path to a Unix-socket. URI string `conf:"name=Uri,optional"` // User of PostgreSQL server. User string `conf:"optional"` // Password to send to protected PostgreSQL server. Password string `conf:"optional"` // Database of PostgreSQL server. Database string `conf:"optional"` // Connection type of PostgreSQL server. TLSConnect string `conf:"name=TLSConnect,optional"` // Certificate Authority filepath for PostgreSQL server. TLSCAFile string `conf:"name=TLSCAFile,optional"` // Certificate filepath for PostgreSQL server. TLSCertFile string `conf:"name=TLSCertFile,optional"` // Key filepath for PostgreSQL server. TLSKeyFile string `conf:"name=TLSKeyFile,optional"` // CacheMode for PostgreSQL server. CacheMode string `conf:"name=CacheMode,optional"` }
Session struct holds individual options for PostgreSQL connection for each session.
Source Files ¶
- config.go
- conn.go
- handler_archive.go
- handler_autovacuum.go
- handler_bgwriter.go
- handler_cache.go
- handler_connections.go
- handler_custom_query.go
- handler_database_age.go
- handler_database_size.go
- handler_databases_bloating.go
- handler_databases_discovery.go
- handler_dbstat.go
- handler_locks.go
- handler_oldest_xid.go
- handler_ping.go
- handler_queries.go
- handler_replication.go
- handler_replication_process_name_discovery.go
- handler_uptime.go
- handler_version.go
- handler_wal.go
- metrics.go
- postgresql.go
- testpool.go