Skip to content

Commit

Permalink
Merge pull request #72 from flycash/main
Browse files Browse the repository at this point in the history
eorm: 使用eorm作为标签名字
  • Loading branch information
flycash authored May 25, 2022
2 parents 85e80a0 + 44e6e19 commit 8bf92f9
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions .CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- [改名为 eorm, 并且改为纯中文项目](https://github.com/gotomicro/eorm/pull/59)
- [internal/value: 抽象 Value 接口与基于反射的实现](https://github.com/gotomicro/eorm/pull/60)
- [eorm: 改为依赖 value 包来获取值](https://github.com/gotomicro/eorm/pull/62)
- [eorm: 使用eorm作为标签名字](https://github.com/gotomicro/eorm/pull/72)

### 文档, 代码质量以及文档
- [Add examples and docs for Aggregate and Assign](https://github.com/gotomicro/eorm/pull/50)
Expand Down
4 changes: 2 additions & 2 deletions expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ func (r RawExpr) expr() (string, error) {
return r.raw, nil
}

// AsPredicate return the Predicate represented by this RawExpr
// EQL has no validation for Predicate
// AsPredicate 将会返回一个 Predicate,RawExpr 将会作为这个 Predicate 的左边部分
// eorm 将不会校验任何从 RawExpr 生成的 Predicate
func (r RawExpr) AsPredicate() Predicate {
return Predicate{
left: r,
Expand Down
4 changes: 2 additions & 2 deletions internal/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func NewMetaRegistry() MetaRegistry {
return &tagMetaRegistry{}
}

// tagMetaRegistry is the default implementation based on tag eql
// tagMetaRegistry is the default implementation based on tag eorm
type tagMetaRegistry struct {
metas sync.Map
}
Expand Down Expand Up @@ -80,7 +80,7 @@ func (t *tagMetaRegistry) Register(table interface{}, opts ...TableMetaOption) (
fieldMap := make(map[string]*ColumnMeta, lens)
for i := 0; i < lens; i++ {
structField := v.Field(i)
tag := structField.Tag.Get("eql")
tag := structField.Tag.Get("eorm")
var isKey, isAuto, isIgnore bool
for _, t := range strings.Split(tag, ",") {
switch t {
Expand Down
6 changes: 3 additions & 3 deletions internal/model/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ func TestIgnoreFieldsOption(t *testing.T) {
}

type TestIgnoreModel struct {
Id int64 `eql:"auto_increment,primary_key,-"`
Id int64 `eorm:"auto_increment,primary_key,-"`
FirstName string
Age int8 `eql:"-"`
Age int8 `eorm:"-"`
LastName string
}

Expand Down Expand Up @@ -146,7 +146,7 @@ case3:
}

type TestModel struct {
Id int64 `eql:"auto_increment,primary_key"`
Id int64 `eorm:"auto_increment,primary_key"`
FirstName string
Age int8
LastName *string
Expand Down
2 changes: 1 addition & 1 deletion predicate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func TestPredicate_C(t *testing.T) {
}

type TestModel struct {
Id int64 `eql:"auto_increment,primary_key"`
Id int64 `eorm:"auto_increment,primary_key"`
FirstName string
Age int8
LastName *string
Expand Down
2 changes: 1 addition & 1 deletion update.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (u *Updater) buildAssigns() error {
}
has = true
default:
return fmt.Errorf("eql: unsupported assignment %v", a)
return fmt.Errorf("eorm: unsupported assignment %v", a)
}
}
if !has {
Expand Down

0 comments on commit 8bf92f9

Please sign in to comment.