Documentation
¶
Overview ¶
Package database provides explicit SQL, GORM, and sqlx connectors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Dialect store data used by this type.
Dialect Dialect
// DSN store data used by this type.
DSN string
// ORM store data used by this type.
ORM ORM
// MaxOpenConns store data used by this type.
MaxOpenConns int
// MaxIdleConns store data used by this type.
MaxIdleConns int
// ConnMaxLifetime store data used by this type.
ConnMaxLifetime time.Duration
// PingTimeout store data used by this type.
PingTimeout time.Duration
}
Config defines an implementation type used by this package.
type Connection ¶
type Connection struct {
// SQL store data used by this type.
SQL *sql.DB
// GORM store data used by this type.
GORM *gorm.DB
// SQLX store data used by this type.
SQLX *sqlx.DB
}
Connection defines an implementation type used by this package.
func Open ¶
func Open(ctx context.Context, config Config) (*Connection, error)
Open performs this package operation.
func (*Connection) Close ¶
func (c *Connection) Close() error
Close performs this package operation.
type Dialect ¶
type Dialect string
Dialect defines an implementation type used by this package.
const ( // MySQL define package-level implementation state. MySQL Dialect = "mysql" // MariaDB define package-level implementation state. MariaDB Dialect = "mariadb" // Postgres define package-level implementation state. Postgres Dialect = "postgres" // SQLite define package-level implementation state. SQLite Dialect = "sqlite" )
Click to show internal directories.
Click to hide internal directories.