Documentation
¶
Index ¶
Constants ¶
View Source
const Postgres = "postgres"
View Source
const Sqlite = "sqlite3"
Variables ¶
This section is empty.
Functions ¶
func NewMigrationRunner ¶
func NewMigrationRunner(databaseConnection *DBConnection) (*migrate.Migrate, error)
func ReplacePlaceholders ¶ added in v0.2.2
ReplacePlaceholders replaces each '?' in the input string with $1, $2, ..., $n
Types ¶
type DBConnection ¶
type DBConnection struct {
ConnType string
// contains filtered or unexported fields
}
func Connect ¶
func Connect(connStr string) (*DBConnection, error)
func (*DBConnection) MigrateUp ¶
func (dbc *DBConnection) MigrateUp() error
func (*DBConnection) Query ¶
func (dbc *DBConnection) Query(ctx context.Context, rowMapper func(scan func(dest ...any) error) (bool, error), sql string, parameters ...any) error
Query the database and map the results using the provided rowMapper function. The rowMapper function gets the sql.Rows#Scan method as an argument, if it returns false, the loop will break, the same if it returns an error.
Click to show internal directories.
Click to hide internal directories.