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

@@ -1,6 +1,6 @@
package clauses
const (
ExprSep = "__"
ExprDot = "."
ExprSep = "__"
ExprDot = "."
)

View File

@@ -1,8 +1,9 @@
package order_clause
import (
"github.com/beego/beego/v2/client/orm/clauses"
"strings"
"github.com/beego/beego/v2/client/orm/clauses"
)
type Sort int8

View File

@@ -16,10 +16,11 @@ package orm
import (
"fmt"
"github.com/beego/beego/v2/client/orm/clauses"
"github.com/beego/beego/v2/client/orm/clauses/order_clause"
"strings"
"time"
"github.com/beego/beego/v2/client/orm/clauses"
"github.com/beego/beego/v2/client/orm/clauses/order_clause"
)
// table info struct.

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
}
}

View File

@@ -369,7 +369,7 @@ func (mc *_modelCache) register(prefixOrSuffixStr string, prefixOrSuffix bool, m
}
if _, ok := mc.get(table); ok {
return nil
return nil
}
mi := newModelInfo(val)

View File

@@ -58,11 +58,12 @@ import (
"database/sql"
"errors"
"fmt"
"github.com/beego/beego/v2/client/orm/clauses/order_clause"
"os"
"reflect"
"time"
"github.com/beego/beego/v2/client/orm/clauses/order_clause"
"github.com/beego/beego/v2/client/orm/hints"
"github.com/beego/beego/v2/core/utils"

View File

@@ -16,8 +16,9 @@ package orm
import (
"fmt"
"github.com/beego/beego/v2/client/orm/clauses"
"strings"
"github.com/beego/beego/v2/client/orm/clauses"
)
// ExprSep define the expression separation

View File

@@ -21,7 +21,6 @@ import (
"context"
"database/sql"
"fmt"
"github.com/beego/beego/v2/client/orm/clauses/order_clause"
"io/ioutil"
"math"
"os"
@@ -32,6 +31,8 @@ import (
"testing"
"time"
"github.com/beego/beego/v2/client/orm/clauses/order_clause"
"github.com/beego/beego/v2/client/orm/hints"
"github.com/stretchr/testify/assert"