Navigation Menu

Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

Commit

Permalink
add test and remove unused warn log (#886)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Apr 11, 2018
1 parent c8ae6fa commit 5c2af83
Show file tree
Hide file tree
Showing 5 changed files with 411 additions and 348 deletions.
5 changes: 4 additions & 1 deletion engine_cond.go
Expand Up @@ -9,6 +9,7 @@ import (
"encoding/json"
"fmt"
"reflect"
"strings"
"time"

"github.com/go-xorm/builder"
Expand Down Expand Up @@ -51,7 +52,9 @@ func (engine *Engine) buildConds(table *core.Table, bean interface{},

fieldValuePtr, err := col.ValueOf(bean)
if err != nil {
engine.logger.Error(err)
if !strings.Contains(err.Error(), "is not valid") {
engine.logger.Warn(err)
}
continue
}

Expand Down
13 changes: 13 additions & 0 deletions error.go
Expand Up @@ -6,6 +6,7 @@ package xorm

import (
"errors"
"fmt"
)

var (
Expand All @@ -25,4 +26,16 @@ var (
ErrNotImplemented = errors.New("Not implemented")
// ErrConditionType condition type unsupported
ErrConditionType = errors.New("Unsupported conditon type")
// ErrColumnIsNotExist columns is not exist
ErrFieldIsNotExist = errors.New("Field is not exist")
)

// ErrFieldIsNotValid is not valid
type ErrFieldIsNotValid struct {
FieldName string
TableName string
}

func (e ErrFieldIsNotValid) Error() string {
return fmt.Sprintf("field %s is not valid on table %s", e.FieldName, e.TableName)
}
1 change: 1 addition & 0 deletions interface.go
Expand Up @@ -42,6 +42,7 @@ type Interface interface {
IsTableExist(beanOrTableName interface{}) (bool, error)
Iterate(interface{}, IterFunc) error
Limit(int, ...int) *Session
MustCols(columns ...string) *Session
NoAutoCondition(...bool) *Session
NotIn(string, ...interface{}) *Session
Join(joinOperator string, tablename interface{}, condition string, args ...interface{}) *Session
Expand Down

0 comments on commit 5c2af83

Please sign in to comment.