gmm

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GMMBuilder

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

GMMBuilder struct for building and managing the mock MySQL server

func Builder

func Builder(db ...string) *GMMBuilder

Builder initializes a new GMMBuilder instance with db name, if db name is not provided, gmm would generate a random db name.

func (*GMMBuilder) Build

func (b *GMMBuilder) Build() (sDB *sql.DB, gDB *gorm.DB, shutdown func(), err error)

Build initializes and starts the MySQL server, returns handles to SQL and Gorm DB

func (*GMMBuilder) CreateTable

func (b *GMMBuilder) CreateTable(table schema.Tabler) *GMMBuilder

CreateTable adds a table to be created upon initialization

func (*GMMBuilder) InitData

func (b *GMMBuilder) InitData(data interface{}) *GMMBuilder

InitData adds initialization data to the mock database

func (*GMMBuilder) LogSilent added in v1.0.5

func (b *GMMBuilder) LogSilent(logSilent bool) *GMMBuilder

LogSilent sets the log mode for the MySQL server, default is silent mode.

func (*GMMBuilder) Port

func (b *GMMBuilder) Port(port int) *GMMBuilder

Port sets the port for the MySQL server, if not set, gmm would generate a port start from 19527

func (*GMMBuilder) SQLFiles

func (b *GMMBuilder) SQLFiles(files ...string) *GMMBuilder

SQLFiles adds SQL files whose contents are to be executed upon initialization

func (*GMMBuilder) SQLStmts

func (b *GMMBuilder) SQLStmts(stmts ...string) *GMMBuilder

SQLStmts adds SQL statements to be executed upon initialization

Jump to

Keyboard shortcuts

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