Documentation ¶
Index ¶
- type GMMBuilder
- func (b *GMMBuilder) Build() (sDB *sql.DB, gDB *gorm.DB, shutdown func(), err error)
- func (b *GMMBuilder) CreateTable(table schema.Tabler) *GMMBuilder
- func (b *GMMBuilder) InitData(data interface{}) *GMMBuilder
- func (b *GMMBuilder) LogSilent(logSilent bool) *GMMBuilder
- func (b *GMMBuilder) Port(port int) *GMMBuilder
- func (b *GMMBuilder) SQLFiles(files ...string) *GMMBuilder
- func (b *GMMBuilder) SQLStmts(stmts ...string) *GMMBuilder
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 ¶
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