Documentation ¶
Index ¶
- func Connect(ctx context.Context, tp trace.TracerProvider, driver, dsn string) (db *sql.DB, err error)
- func ConnectMySQL(tp trace.TracerProvider, dsn string) (db *sql.DB, err error)
- func ConnectSQLite(tp trace.TracerProvider, dsn string) (db *sql.DB, err error)
- func FormatOptionalString(s string) *string
- func FormatOptionalTime(nt sql.NullTime) *string
- func FormatTime(t time.Time) string
- func MigrateEnduroDatabase(db *sql.DB) error
- func MigrateEnduroStorageDatabase(db *sql.DB) error
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
func Connect(ctx context.Context, tp trace.TracerProvider, driver, dsn string) (db *sql.DB, err error)
Connect returns a database handler.
func ConnectMySQL ¶
ConnectMySQL returns a MySQL database handler which is safe for concurrent access.
func ConnectSQLite ¶
ConnectSQLite returns a SQLlite database handler which is NOT safe for concurrent access.
func FormatOptionalString ¶
FormatOptionalString returns the nil value when the string is empty.
func FormatOptionalTime ¶
FormatOptionalTime returns the nil value when the value is NULL in the db.
func FormatTime ¶
FormatTime returns an empty string when t has the zero value.
func MigrateEnduroDatabase ¶
Types ¶
type Config ¶
type Config struct { // Driver specifies the database driver (e.g. "mysql" or "sqlite3"). Driver string // DSN (Data Source Name) specifies the database connection information. DSN string // Migrate specifies whether to run migrations (true) to upgrade the // database schema or not (false). Migrate bool }
Click to show internal directories.
Click to hide internal directories.