mysqltestcontainer

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DbInfo added in v1.4.0

type DbInfo struct {
	Username string
	Password string
	Ip       string
	Port     string
	DbName   string
}

type MySql added in v1.3.0

type MySql struct {
	// contains filtered or unexported fields
}

func Create added in v1.3.0

func Create(databaseName string) (*MySql, error)

Create creates a container containing MySQL in Docker & returns the connection info along with the created database.

Example
package main

import (
	"github.com/arikama/go-mysql-test-container/mysqltestcontainer"
	"github.com/containerd/containerd/log"
)

func main() {
	mySql, _ := mysqltestcontainer.Create("test")
	db := mySql.GetDb()
	err := db.Ping()
	if err != nil {
		log.L.Errorln(err.Error())
	}
}
Output:

func (*MySql) GetDb added in v1.4.0

func (m *MySql) GetDb() *sql.DB

func (*MySql) GetDbInfo added in v1.4.0

func (m *MySql) GetDbInfo() *DbInfo

Jump to

Keyboard shortcuts

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