Versions in this module Expand all Collapse all v0 v0.0.1 Aug 24, 2023 Changes in this version + const Case_Lower + const Case_No_Change + const Case_Snake + const Case_Upper + const Condition_Diff_In_Length + const Condition_Diff_In_Value + const Condition_The_Same + var CSVColumnParser = func(s string) []byte + var ErrCancelled = errors.New("canceling query due to user request") + func ConvertStringFormats(input string, convertCase uint8) (formatted string) + func FetchResultsFromRows(rows *sql.Rows) (results [][]string, err error) + func FetchResultsFromRowsComparator(rows *sql.Rows) (results [][]string, err error) + func GetGenuineLocation() (path string) + func GetMockLocation() (path string) + func LoadMockConfig(sqlMock Sqlmock, subPath, jsonFile string) (error error) + func MakeCreateTableSQLStr(tableName string, model interface{}, convertCase uint8) (sqlStr string, err error) + func MakeInsertTableSQLStr(tableName string, model interface{}, convertCase uint8) (sqlStr string) + func MakeSelectTableSQLStr(tableName string, model interface{}, convertCase uint8) (sqlStr string) + func MonitorPingsOption(monitorPings bool) func(*sqlmock) error + func NewErrorResult(err error) driver.Result + func NewResult(lastInsertID int64, rowsAffected int64) driver.Result + func QueryMatcherOption(queryMatcher QueryMatcher) func(*sqlmock) error + func SetGenuineLocationByManual(path string) + func SetMockLocationByManual(path string) + func SetMockOrGenuineLocationByTriggerMain(isGenuine bool) + func ValueConverterOption(converter driver.ValueConverter) func(*sqlmock) error + type Argument interface + Match func(driver.Value) bool + func AnyArg() Argument + type BasicOptions struct + UseDB bool + type Column struct + func NewColumn(name string) *Column + func (c *Column) DbType() string + func (c *Column) IsNullable() (bool, bool) + func (c *Column) Length() (int64, bool) + func (c *Column) Name() string + func (c *Column) Nullable(nullable bool) *Column + func (c *Column) OfType(dbType string, sampleValue interface{}) *Column + func (c *Column) PrecisionScale() (int64, int64, bool) + func (c *Column) ScanType() reflect.Type + func (c *Column) WithLength(length int64) *Column + func (c *Column) WithPrecisionAndScale(precision, scale int64) *Column + type ConfigRows struct + Columns []string + Rows [][]driver.Value + type ConfigSet struct + QueryArgs []driver.Value + QueryString string + ReturnRows []ConfigRows + type DBOptions struct + ConfigFile []string + ConfigSubFolder string + DS DataSource + OP Operate + func LoadGenuineConfig(subPath, jsonFile string) (dbOpts DBOptions, err error) + type DataSource struct + DbName string + Driver string + IP string + Password string + Port string + Protocal string + User string + type DiffPlace struct + AfterValue string + BeforeValue string + ColumnIndex int + RowIndex int + func CompareResults(results1, results2 [][]string) (same bool, condition uint8, differences []DiffPlace) + type EraseTableAction string + const EraseDropTableAction + const EraseTruncateTableAction + type ExpectedBegin struct + func (e *ExpectedBegin) String() string + func (e *ExpectedBegin) WillDelayFor(duration time.Duration) *ExpectedBegin + func (e *ExpectedBegin) WillReturnError(err error) *ExpectedBegin + type ExpectedClose struct + func (e *ExpectedClose) String() string + func (e *ExpectedClose) WillReturnError(err error) *ExpectedClose + type ExpectedCommit struct + func (e *ExpectedCommit) String() string + func (e *ExpectedCommit) WillReturnError(err error) *ExpectedCommit + type ExpectedExec struct + func (e *ExpectedExec) String() string + func (e *ExpectedExec) WillDelayFor(duration time.Duration) *ExpectedExec + func (e *ExpectedExec) WillReturnError(err error) *ExpectedExec + func (e *ExpectedExec) WillReturnResult(result driver.Result) *ExpectedExec + func (e *ExpectedExec) WithArgs(args ...driver.Value) *ExpectedExec + type ExpectedPing struct + func (e *ExpectedPing) String() string + func (e *ExpectedPing) WillDelayFor(duration time.Duration) *ExpectedPing + func (e *ExpectedPing) WillReturnError(err error) *ExpectedPing + type ExpectedPrepare struct + func (e *ExpectedPrepare) ExpectExec() *ExpectedExec + func (e *ExpectedPrepare) ExpectQuery() *ExpectedQuery + func (e *ExpectedPrepare) String() string + func (e *ExpectedPrepare) WillBeClosed() *ExpectedPrepare + func (e *ExpectedPrepare) WillDelayFor(duration time.Duration) *ExpectedPrepare + func (e *ExpectedPrepare) WillReturnCloseError(err error) *ExpectedPrepare + func (e *ExpectedPrepare) WillReturnError(err error) *ExpectedPrepare + type ExpectedQuery struct + func (e *ExpectedQuery) RowsWillBeClosed() *ExpectedQuery + func (e *ExpectedQuery) String() string + func (e *ExpectedQuery) WillDelayFor(duration time.Duration) *ExpectedQuery + func (e *ExpectedQuery) WillReturnError(err error) *ExpectedQuery + func (e *ExpectedQuery) WillReturnRows(rows ...*Rows) *ExpectedQuery + func (e *ExpectedQuery) WithArgs(args ...driver.Value) *ExpectedQuery + type ExpectedRollback struct + func (e *ExpectedRollback) String() string + func (e *ExpectedRollback) WillReturnError(err error) *ExpectedRollback + type MockOptions struct + ConfigFile []string + ConfigSubFolder string + type Mocker struct + func NewMocker(mOpts MockerOptions) (mocker *Mocker, err error) + func (m *Mocker) Close() + func (m *Mocker) DSN() string + func (m *Mocker) EraseTable(action EraseTableAction, db string, tables ...string) (err error) + func (m *Mocker) Exec(query string, args ...any) (sql.Result, error) + func (m *Mocker) Query(query string, args ...any) (*sql.Rows, error) + type MockerOptions struct + Basic BasicOptions + DB DBOptions + Mock MockOptions + func NewMockerOptions(funcs ...SetMockOptsFunc) MockerOptions + type Operate struct + DropTable bool + TruncateTable bool + type QueryMatcher interface + Match func(expectedSQL, actualSQL string) error + var QueryMatcherEqual QueryMatcher = QueryMatcherFunc(func(expectedSQL, actualSQL string) error { ... }) + var QueryMatcherRegexp QueryMatcher = QueryMatcherFunc(func(expectedSQL, actualSQL string) error { ... }) + type QueryMatcherFunc func(expectedSQL, actualSQL string) error + func (f QueryMatcherFunc) Match(expectedSQL, actualSQL string) error + type Rows struct + func NewRows(columns []string) *Rows + func NewRowsWithColumnDefinition(columns ...*Column) *Rows + func (r *Rows) AddRow(values ...driver.Value) *Rows + func (r *Rows) CloseError(err error) *Rows + func (r *Rows) FromCSVString(s string) *Rows + func (r *Rows) RowError(row int, err error) *Rows + type SetMockOptsFunc func(*MockerOptions) + func WithBasicOptions(basicOpts BasicOptions) SetMockOptsFunc + func WithDBOptions(dbOpts DBOptions) SetMockOptsFunc + func WithMockOptions(mockOpts MockOptions) SetMockOptsFunc + type Sqlmock interface + NewColumn func(name string) *Column + NewRowsWithColumnDefinition func(columns ...*Column) *Rows + func New(options ...func(*sqlmock) error) (*sql.DB, Sqlmock, error) + func NewWithDSN(dsn string, options ...func(*sqlmock) error) (*sql.DB, Sqlmock, error) + func Newx(options ...func(*sqlmock) error) (*sqlx.DB, Sqlmock, error) + func NewxWithDSN(dsn string, options ...func(*sqlmock) error) (*sqlx.DB, Sqlmock, error) + type SqlmockCommon interface + ExpectBegin func() *ExpectedBegin + ExpectClose func() *ExpectedClose + ExpectCommit func() *ExpectedCommit + ExpectExec func(expectedSQL string) *ExpectedExec + ExpectPing func() *ExpectedPing + ExpectPrepare func(expectedSQL string) *ExpectedPrepare + ExpectQuery func(expectedSQL string) *ExpectedQuery + ExpectRollback func() *ExpectedRollback + ExpectationsWereMet func() error + MatchExpectationsInOrder func(bool) + NewRows func(columns []string) *Rows