Documentation
¶
Index ¶
- func NewConnection(cfg *config.DatabaseConfig, log logger.Logger) (database.Interface, error)
- type Connection
- func (c *Connection) Begin(ctx context.Context) (*sql.Tx, error)
- func (c *Connection) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
- func (c *Connection) Close() error
- func (c *Connection) CreateMigrationTable(ctx context.Context) error
- func (c *Connection) DatabaseType() string
- func (c *Connection) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (c *Connection) GetMigrationTable() string
- func (c *Connection) Health(ctx context.Context) error
- func (c *Connection) Prepare(ctx context.Context, query string) (*sql.Stmt, error)
- func (c *Connection) Query(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (c *Connection) QueryRow(ctx context.Context, query string, args ...interface{}) *sql.Row
- func (c *Connection) Stats() (map[string]interface{}, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConnection ¶
NewConnection creates a new PostgreSQL connection
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection implements the database.Interface for PostgreSQL
func (*Connection) CreateMigrationTable ¶
func (c *Connection) CreateMigrationTable(ctx context.Context) error
CreateMigrationTable creates the migration table if it doesn't exist
func (*Connection) DatabaseType ¶
func (c *Connection) DatabaseType() string
DatabaseType returns the database type
func (*Connection) Exec ¶
func (c *Connection) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
Exec executes a query without returning any rows
func (*Connection) GetMigrationTable ¶
func (c *Connection) GetMigrationTable() string
GetMigrationTable returns the migration table name for PostgreSQL
func (*Connection) Health ¶
func (c *Connection) Health(ctx context.Context) error
Health checks database connectivity
func (*Connection) Query ¶
func (c *Connection) Query(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
Query executes a query that returns rows
func (*Connection) Stats ¶
func (c *Connection) Stats() (map[string]interface{}, error)
Stats returns database connection statistics
Click to show internal directories.
Click to hide internal directories.