mysql

package module
v0.0.0-...-dab9aff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2024 License: MIT Imports: 4 Imported by: 0

README

MySQL

Package mysql providers MySQL database driver.

Installation

go get -u github.com/gopi-frame/database/mysql

Import

import _ "github.com/gopi-frame/database/mysql"

Usage

package main

import (
    "github.com/gopi-frame/database"

    _ "github.com/gopi-frame/database/mysql"
)

func main() {
    db, err := database.Connect("mysql", map[string]any{
        "dsn": "user:password@tcp(127.0.0.1:3306)/database?parseTime=true",
    })
    if err!= nil {
        panic(err)
    }
}

Options

This package uses package mapstructure to parse options.

For more information on the options, see mysql.Config.

Example
var options = map[string]any{
    "dsn": "user:password@tcp(127.0.0.1:3306)/database?parseTime=true",
    "SkipInitializeWithVersion": true,
    "DefaultStringSize":         255,
}

Documentation

Overview

Package mysql provides a mysql database driver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver struct{}

Driver is a mysql database driver.

func (Driver) Open

func (Driver) Open(options map[string]any) (gorm.Dialector, error)

Open opens a mysql database connector. For more information on the options, see mysql.Config(https://pkg.go.dev/gorm.io/driver/mysql#Config).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL