mockdb

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DBType string = "sqlite3"

Functions

This section is empty.

Types

type Logger

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

func NewLogger

func NewLogger(tag string) *Logger

func (*Logger) Error

func (l *Logger) Error(msg interface{})

func (*Logger) Log

func (l *Logger) Log(msg interface{})

func (*Logger) Panic

func (l *Logger) Panic(msg interface{})

func (*Logger) Warn

func (l *Logger) Warn(msg interface{})

type MockGORM

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

func NewGORMFromDSN

func NewGORMFromDSN(pathToSqlFileName string, dbType string, dsn string) *MockGORM

func NewMockGORM

func NewMockGORM(pathToSqlFileName string, dbName string) *MockGORM

func (*MockGORM) DoRecord

func (m *MockGORM) DoRecord(db *gorm.DB)

func (*MockGORM) DumpRecorderInfo

func (m *MockGORM) DumpRecorderInfo() map[string][]string

func (*MockGORM) GetDBUtil

func (m *MockGORM) GetDBUtil() *util.DBUtil

func (*MockGORM) GetDSN

func (m *MockGORM) GetDSN() (dbType string, dsn string)

func (*MockGORM) GetGormDB

func (m *MockGORM) GetGormDB() *gorm.DB

GetGormDB 获取Gorm实例

func (*MockGORM) GetSqlDB

func (m *MockGORM) GetSqlDB() *sql.DB

GetSqlDB 获取*sql.DB实例

func (*MockGORM) InitSchemas

func (m *MockGORM) InitSchemas(sqlSchema string)

InitSchemas 为了兼容github.com/jinzhu/gorm mysql的bug 特殊处理的

func (*MockGORM) RegisterModels

func (m *MockGORM) RegisterModels(models ...interface{})

RegisterModels 注册模型

func (*MockGORM) ResetAndInit

func (m *MockGORM) ResetAndInit()

ResetAndInit 初始化数据库及表数据

func (*MockGORM) SaveRecordToFile

func (m *MockGORM) SaveRecordToFile(dir string)

func (*MockGORM) SaveRecordToFileAuto added in v1.3.0

func (m *MockGORM) SaveRecordToFileAuto(dir string)

type MockGORMV2

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

func NewGORMV2FromDSN

func NewGORMV2FromDSN(pathToSqlFileName string, dbType string, dsn string) *MockGORMV2

func NewMockGORMV2

func NewMockGORMV2(pathToSqlFileName string, dbName string) *MockGORMV2

func (*MockGORMV2) DoRecord

func (m *MockGORMV2) DoRecord(db *gorm.DB)

func (*MockGORMV2) DumpRecorderInfo

func (m *MockGORMV2) DumpRecorderInfo() map[string][]string

func (*MockGORMV2) GetDBUtil

func (m *MockGORMV2) GetDBUtil() *util.DBUtil

func (*MockGORMV2) GetDSN

func (m *MockGORMV2) GetDSN() (dbType string, dsn string)

func (*MockGORMV2) GetGormDB

func (m *MockGORMV2) GetGormDB() *gorm.DB

GetGormDB 获取Gorm实例

func (*MockGORMV2) GetSqlDB

func (m *MockGORMV2) GetSqlDB() *sql.DB

GetSqlDB 获取*sql.DB实例

func (*MockGORMV2) InitSchemas

func (m *MockGORMV2) InitSchemas(sqlSchema string)

func (*MockGORMV2) RegisterModels

func (m *MockGORMV2) RegisterModels(models ...interface{})

RegisterModels 注册模型

func (*MockGORMV2) ResetAndInit

func (m *MockGORMV2) ResetAndInit()

ResetAndInit 初始化数据库及表数据

func (*MockGORMV2) SaveRecordToFile

func (m *MockGORMV2) SaveRecordToFile(dir string)

func (*MockGORMV2) SaveRecordToFileAuto added in v1.3.0

func (m *MockGORMV2) SaveRecordToFileAuto(dir string)

type MockXORM

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

func NewMockXORM

func NewMockXORM(pathToSqlFileName string, resetHandler func(orm *MockXORM)) *MockXORM

func NewXORMFromDSN

func NewXORMFromDSN(pathToSqlFileName string, dbType string, dsn string) *MockXORM

func (*MockXORM) DoRecord

func (m *MockXORM) DoRecord(scope *xorm.Engine)

func (*MockXORM) DumpRecorderInfo

func (m *MockXORM) DumpRecorderInfo() map[string][]string

func (*MockXORM) GetDBUtil

func (m *MockXORM) GetDBUtil() *util.DBUtil

func (*MockXORM) GetDSN

func (m *MockXORM) GetDSN() (dbType string, dsn string)

func (*MockXORM) GetSqlDB

func (m *MockXORM) GetSqlDB() *sql.DB

GetSqlDB 获取*sql.DB实例

func (*MockXORM) GetXORMEngine

func (m *MockXORM) GetXORMEngine() *xorm.Engine

GetXORMEngine 获取 *xorm.Engine实例

func (*MockXORM) InitSchemas

func (m *MockXORM) InitSchemas(sqlSchema string)

func (*MockXORM) RegisterModels

func (m *MockXORM) RegisterModels(models ...interface{})

RegisterModels 注册模型

func (*MockXORM) ResetAndInit

func (m *MockXORM) ResetAndInit()

ResetAndInit 初始化数据库及表数据

func (*MockXORM) SaveRecordToFile

func (m *MockXORM) SaveRecordToFile(dir string)

func (*MockXORM) SaveRecordToFileAuto added in v1.3.0

func (m *MockXORM) SaveRecordToFileAuto(dir string)

type MockZORM

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

func NewMockZORM

func NewMockZORM(pathToSqlFileName string, resetHandler func(orm *MockZORM)) *MockZORM

func (*MockZORM) GetDBDao

func (m *MockZORM) GetDBDao() *zorm.DBDao

GetGormDB 获取Gorm实例

func (*MockZORM) GetDBUtil

func (m *MockZORM) GetDBUtil() *util.DBUtil

func (*MockZORM) GetDSN

func (m *MockZORM) GetDSN() (dbType string, dsn string)

func (*MockZORM) GetSqlDB

func (m *MockZORM) GetSqlDB() *sql.DB

GetSqlDB 获取*sql.DB实例

func (*MockZORM) InitSchemas

func (m *MockZORM) InitSchemas(sqlSchema string)

func (*MockZORM) RegisterModels

func (m *MockZORM) RegisterModels(models ...interface{})

RegisterModels 注册模型

func (*MockZORM) ResetAndInit

func (m *MockZORM) ResetAndInit()

ResetAndInit 初始化数据库及表数据

Jump to

Keyboard shortcuts

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