Apply goimports' modifications

This commit is contained in:
Jihoon Seo
2021-01-28 13:42:03 +09:00
parent 2bb6c45786
commit 113b90531c
34 changed files with 57 additions and 67 deletions

View File

@@ -23,14 +23,14 @@ import (
type Mock struct {
cond Condition
resp []interface{}
cb func(inv *orm.Invocation)
cb func(inv *orm.Invocation)
}
func NewMock(cond Condition, resp []interface{}, cb func(inv *orm.Invocation)) *Mock {
return &Mock{
cond: cond,
resp: resp,
cb: cb,
cb: cb,
}
}

View File

@@ -24,7 +24,9 @@ import (
"github.com/beego/beego/v2/client/orm"
)
const mockErrorMsg = "mock error"
func init() {
orm.RegisterModel(&User{})
}
@@ -239,7 +241,7 @@ func TestTransactionRollback(t *testing.T) {
assert.Equal(t, mock, err)
}
func TestTransactionCommit(t *testing.T) {
func TestTransactionCommit(t *testing.T) {
s := StartMock()
defer s.Clear()
mock := errors.New(mockErrorMsg)

View File

@@ -23,7 +23,6 @@ import (
// DoNothingQueryM2Mer do nothing
// use it to build mock orm.QueryM2Mer
type DoNothingQueryM2Mer struct {
}
func (d *DoNothingQueryM2Mer) AddWithCtx(ctx context.Context, i ...interface{}) (int64, error) {
@@ -68,13 +67,13 @@ func (d *DoNothingQueryM2Mer) Count() (int64, error) {
type QueryM2MerCondition struct {
tableName string
name string
name string
}
func NewQueryM2MerCondition(tableName string, name string) *QueryM2MerCondition {
return &QueryM2MerCondition{
tableName: tableName,
name: name,
name: name,
}
}
@@ -88,5 +87,3 @@ func (q *QueryM2MerCondition) Match(ctx context.Context, inv *orm.Invocation) bo
}
return res
}

View File

@@ -60,4 +60,4 @@ func TestNewQueryM2MerCondition(t *testing.T) {
assert.True(t, cond.Match(context.Background(), &orm.Invocation{
Args: []interface{}{0, "A"},
}))
}
}

View File

@@ -61,4 +61,4 @@ func (d *DoNothingRawSetter) RowsToStruct(ptrStruct interface{}, keyCol, valueCo
func (d *DoNothingRawSetter) Prepare() (orm.RawPreparer, error) {
return nil, nil
}
}