Connecting to Database

GenORM executes queries using *sql.DB/*sql.Tx. Therefore, connection to the database can be made in the same way as in database/sql. However, we have only confirmed that it works with MySQL and MariaDB.

Example

import (
  "database/sql"
  _ "github.com/go-sql-driver/mysql"
)

db, err := sql.Open("mysql", "user:pass@tcp(host:port)/database?parseTime=true&loc=Asia%2FTokyo&charset=utf8mb4")

results matching ""

    No results matching ""