Documentation
¶
Index ¶
- type ExecResult
- type PreparedStatement
- func (ps *PreparedStatement) Close() error
- func (ps *PreparedStatement) Exec(ctx context.Context, args ...interface{}) (types.ExecResult, error)
- func (ps *PreparedStatement) Query(ctx context.Context, args ...interface{}) (types.QueryResult, error)
- func (ps *PreparedStatement) QueryRow(ctx context.Context, args ...interface{}) (types.Row, error)
- type Provider
- func (p *Provider) BeginTransaction(ctx context.Context) (types.Transaction, error)
- func (p *Provider) Close() error
- func (p *Provider) Configure(config map[string]interface{}) error
- func (p *Provider) Connect(ctx context.Context) error
- func (p *Provider) Disconnect(ctx context.Context) error
- func (p *Provider) Exec(ctx context.Context, query string, args ...interface{}) (types.ExecResult, error)
- func (p *Provider) GetConnectionInfo() *types.ConnectionInfo
- func (p *Provider) GetName() string
- func (p *Provider) GetStats(ctx context.Context) (*types.DatabaseStats, error)
- func (p *Provider) GetSupportedFeatures() []types.DatabaseFeature
- func (p *Provider) HealthCheck(ctx context.Context) error
- func (p *Provider) IsConfigured() bool
- func (p *Provider) IsConnected() bool
- func (p *Provider) Ping(ctx context.Context) error
- func (p *Provider) Prepare(ctx context.Context, query string) (types.PreparedStatement, error)
- func (p *Provider) Query(ctx context.Context, query string, args ...interface{}) (types.QueryResult, error)
- func (p *Provider) QueryRow(ctx context.Context, query string, args ...interface{}) (types.Row, error)
- func (p *Provider) WithTransaction(ctx context.Context, fn func(types.Transaction) error) error
- type QueryResult
- type Row
- type Transaction
- func (t *Transaction) Commit() error
- func (t *Transaction) Exec(ctx context.Context, query string, args ...interface{}) (types.ExecResult, error)
- func (t *Transaction) Prepare(ctx context.Context, query string) (types.PreparedStatement, error)
- func (t *Transaction) Query(ctx context.Context, query string, args ...interface{}) (types.QueryResult, error)
- func (t *Transaction) QueryRow(ctx context.Context, query string, args ...interface{}) (types.Row, error)
- func (t *Transaction) Rollback() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecResult ¶
type ExecResult struct {
// contains filtered or unexported fields
}
ExecResult represents a PostgreSQL execution result
func (*ExecResult) LastInsertId ¶
func (er *ExecResult) LastInsertId() (int64, error)
LastInsertId returns the last insert ID
func (*ExecResult) RowsAffected ¶
func (er *ExecResult) RowsAffected() (int64, error)
RowsAffected returns the number of rows affected
type PreparedStatement ¶
type PreparedStatement struct {
// contains filtered or unexported fields
}
PreparedStatement represents a PostgreSQL prepared statement
func (*PreparedStatement) Close ¶
func (ps *PreparedStatement) Close() error
Close closes the prepared statement
func (*PreparedStatement) Exec ¶
func (ps *PreparedStatement) Exec(ctx context.Context, args ...interface{}) (types.ExecResult, error)
Exec executes the prepared statement with args
func (*PreparedStatement) Query ¶
func (ps *PreparedStatement) Query(ctx context.Context, args ...interface{}) (types.QueryResult, error)
Query executes the prepared statement with args
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements DatabaseProvider for PostgreSQL
func NewProvider ¶
NewProvider creates a new PostgreSQL database provider
func (*Provider) BeginTransaction ¶
BeginTransaction begins a new transaction
func (*Provider) Disconnect ¶
Disconnect disconnects from the database
func (*Provider) Exec ¶
func (p *Provider) Exec(ctx context.Context, query string, args ...interface{}) (types.ExecResult, error)
Exec executes a query without returning rows
func (*Provider) GetConnectionInfo ¶
func (p *Provider) GetConnectionInfo() *types.ConnectionInfo
GetConnectionInfo returns connection information
func (*Provider) GetSupportedFeatures ¶
func (p *Provider) GetSupportedFeatures() []types.DatabaseFeature
GetSupportedFeatures returns supported features
func (*Provider) HealthCheck ¶
HealthCheck performs a health check on the database
func (*Provider) IsConfigured ¶
IsConfigured checks if the provider is configured
func (*Provider) IsConnected ¶
IsConnected checks if the database is connected
func (*Provider) Query ¶
func (p *Provider) Query(ctx context.Context, query string, args ...interface{}) (types.QueryResult, error)
Query executes a query that returns rows
func (*Provider) QueryRow ¶
func (p *Provider) QueryRow(ctx context.Context, query string, args ...interface{}) (types.Row, error)
QueryRow executes a query that returns a single row
func (*Provider) WithTransaction ¶
WithTransaction executes a function within a transaction
type QueryResult ¶
type QueryResult struct {
// contains filtered or unexported fields
}
QueryResult represents a PostgreSQL query result
func (*QueryResult) Columns ¶
func (qr *QueryResult) Columns() ([]string, error)
Columns returns the column names
func (*QueryResult) Err ¶
func (qr *QueryResult) Err() error
Err returns any error that occurred during iteration
func (*QueryResult) Scan ¶
func (qr *QueryResult) Scan(dest ...interface{}) error
Scan scans the current row into dest
type Row ¶
type Row struct {
// contains filtered or unexported fields
}
Row represents a PostgreSQL row
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction represents a PostgreSQL transaction
func (*Transaction) Exec ¶
func (t *Transaction) Exec(ctx context.Context, query string, args ...interface{}) (types.ExecResult, error)
Exec executes a query without returning rows within the transaction
func (*Transaction) Prepare ¶
func (t *Transaction) Prepare(ctx context.Context, query string) (types.PreparedStatement, error)
Prepare prepares a statement within the transaction
func (*Transaction) Query ¶
func (t *Transaction) Query(ctx context.Context, query string, args ...interface{}) (types.QueryResult, error)
Query executes a query within the transaction
func (*Transaction) QueryRow ¶
func (t *Transaction) QueryRow(ctx context.Context, query string, args ...interface{}) (types.Row, error)
QueryRow executes a query that returns a single row within the transaction
func (*Transaction) Rollback ¶
func (t *Transaction) Rollback() error
Rollback rolls back the transaction