Documentation
¶
Index ¶
- Constants
- func AddMySQLBootstrapCallback(cbk MySQLBootstrapCallback)
- func GetMySQL() *gorm.DB
- func InitMySQL(rail miso.Rail, p MySQLConnParam) error
- func InitMySQLFromProp(rail miso.Rail) error
- func IsMySQLInitialized() bool
- func NewMySQLConn(rail miso.Rail, p MySQLConnParam) (*gorm.DB, error)
- type MySQLBootstrapCallback
- type MySQLConnParam
Constants ¶
View Source
const ( // misoconfig-prop: enable MySQL client | false PropMySQLEnabled = "mysql.enabled" // misoconfig-prop: username | root PropMySQLUser = "mysql.user" // misoconfig-prop: password PropMySQLPassword = "mysql.password" // misoconfig-prop: database PropMySQLSchema = "mysql.database" // misoconfig-prop: host | localhost PropMySQLHost = "mysql.host" // misoconfig-prop: port | 3306 PropMySQLPort = "mysql.port" // misoconfig-prop: log sql statements | false PropMySQLLogSQL = "mysql.log-sql" // misoconfig-prop: connection parameters (slices of strings) (see [go-sql-driver/mysql](https://github.com/go-sql-driver/mysql?tab=readme-ov-file#dsn-data-source-name)) | `[]string{"charset=utf8mb4", "parseTime=true", "loc=Local", "readTimeout=30s", "writeTimeout=30s", "timeout=3s", "collation=utf8mb4_general_ci"}` PropMySQLConnParam = "mysql.connection.parameters" // misoconfig-prop: connection lifetime in minutes (hikari recommends 1800000, so we do the same thing) | 30 PropMySQLConnLifetime = "mysql.connection.lifetime" // misoconfig-prop: max number of open connections | 10 PropMySQLMaxOpenConns = "mysql.connection.open.max" // misoconfig-prop: max number of idle connections | 10 PropMySQLMaxIdleConns = "mysql.connection.idle.max" )
misoconfig-section: MySQL Configuration
Variables ¶
This section is empty.
Functions ¶
func AddMySQLBootstrapCallback ¶
func AddMySQLBootstrapCallback(cbk MySQLBootstrapCallback)
func InitMySQL ¶
func InitMySQL(rail miso.Rail, p MySQLConnParam) error
Init Handle to the database
If mysql client has been initialized, current func call will be ignored.
func InitMySQLFromProp ¶
Init connection to mysql
If mysql client has been initialized, current func call will be ignored.
This func looks for following props:
"mysql.user" "mysql.password" "mysql.database" "mysql.host" "mysql.port" "mysql.connection.parameters"
func NewMySQLConn ¶
Create new MySQL connection
Types ¶
Click to show internal directories.
Click to hide internal directories.