Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrOpeningDatabase is returned when the database cannot be opened. ErrOpeningDatabase = errors.New("error opening database") // ErrBeginningTransaction is returned when the transaction cannot be started. ErrBeginningTransaction = errors.New("error beginning transaction") // ErrNilConfiguration is returned when the configuration is nil. ErrNilConfiguration = errors.New("error nil configuration") // ErrDBIsNil is the error returned when the database is nil. ErrDBIsNil = errors.New("database is nil") // ErrExec is the error returned when the query cannot be executed. ErrExec = errors.New("error executing dml") // ErrCommittingTransaction is the error returned when the transaction cannot be committed. ErrCommittingTransaction = errors.New("error committing transaction") // ErrRollingBackTransaction is the error returned when the transaction cannot be rolled back. ErrRollingBackTransaction = errors.New("error rolling back transaction") // ErrQueryingDatabase is the error returned when the database cannot be queried. ErrQueryingDatabase = errors.New("error querying database") )
Functions ¶
This section is empty.
Types ¶
type PostgresConfiguration ¶
type PostgresConfiguration struct {
Host string
Port int
User string
Password string
Database string
}
func NewDefaultPostgresConfiguration ¶
func NewDefaultPostgresConfiguration() (configuration *PostgresConfiguration)
func NewPostgresConfigurationFromEnv ¶
func NewPostgresConfigurationFromEnv() (configuration *PostgresConfiguration)
func (*PostgresConfiguration) GetDataSourceName ¶
func (configuration *PostgresConfiguration) GetDataSourceName() (dataSourceName string)
type PostgresDatabase ¶
type PostgresDatabase interface {
Open() (db *sql.DB, err error)
Close(db *sql.DB) (err error)
BeginTx(db *sql.DB) (tx *sql.Tx, err error)
Commit(tx *sql.Tx) (err error)
Rollback(tx *sql.Tx) (err error)
Exec(tx *sql.Tx, query string, args ...interface{}) (result sql.Result, err error)
Query(tx *sql.Tx, query string, args ...interface{}) (rows *sql.Rows, err error)
}
func NewBasePostgresDatabase ¶
func NewBasePostgresDatabase(postgresConfig *PostgresConfiguration) PostgresDatabase
NewBasePostgresDatabase creates a new instance of PostgresDatabase interface implementation.
Click to show internal directories.
Click to hide internal directories.