Documentation ¶
Index ¶
- Constants
- Variables
- func HandleError(err error, description string) error
- type Config
- type ConfigFunc
- type Initializer
- type LoggingDB
- func (db *LoggingDB) Beginx() (*LoggingTx, error)
- func (db *LoggingDB) Exec(query string, args ...interface{}) (sql.Result, error)
- func (db *LoggingDB) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (db *LoggingDB) QueryRowx(query string, args ...interface{}) *sqlx.Row
- func (db *LoggingDB) Queryx(query string, args ...interface{}) (*sqlx.Rows, error)
- type LoggingTx
- func (tx *LoggingTx) Exec(query string, args ...interface{}) (sql.Result, error)
- func (tx *LoggingTx) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (tx *LoggingTx) QueryRowx(query string, args ...interface{}) *sqlx.Row
- func (tx *LoggingTx) Queryx(query string, args ...interface{}) (*sqlx.Rows, error)
- type PageMeta
- type PagedResultMeta
Constants ¶
View Source
const MaxPingAttempts = 15
View Source
const ServiceName = "db"
Variables ¶
View Source
var ( ErrDoesNotExist = fmt.Errorf("record does not exist") ErrAlreadyExists = fmt.Errorf("record already exists") )
Functions ¶
func HandleError ¶
Types ¶
type Config ¶
type Config struct { DatabaseURL string `env:"database_url" required:"true"` LogSQLQueries bool `env:"log_sql_queries" default:"false"` MigrationsTable string `env:"migrations_table"` MigrationsSchemaName string `env:"migrations_schema_name"` FailOnNewerMigrationVersion bool `env:"fail_on_newer_migration_version"` }
type ConfigFunc ¶
type ConfigFunc func(*options)
ConfigFunc is a function used to configure an initializer.
func WithMigrationSourceDriver ¶
func WithMigrationSourceDriver(sourceDriver source.Driver) ConfigFunc
WithMigrationSourceDriver sets the migration source driver.
type Initializer ¶
type Initializer struct { Logger nacelle.Logger `service:"logger"` Services nacelle.ServiceContainer `service:"services"` // contains filtered or unexported fields }
func NewInitializer ¶
func NewInitializer(configs ...ConfigFunc) *Initializer
type PagedResultMeta ¶
func PagedSelect ¶
func PagedSelect( db *LoggingDB, meta *PageMeta, baseQuery string, target interface{}, args ...interface{}, ) (*PagedResultMeta, error)
Click to show internal directories.
Click to hide internal directories.