Remove method Not for less confuse

This commit is contained in:
Jinzhu 2013-10-27 12:33:16 +08:00
parent 2a08333bf6
commit ea4dee3ba8
4 changed files with 0 additions and 17 deletions

View File

@ -3,8 +3,6 @@
Yet Another ORM library for Go, aims for developer friendly
## TODO
* Or query
* Not query
* Better First method (First(&user, primary_key, where conditions))
* Even more complex where query (with map or struct)
* ORM.Errors

6
orm.go
View File

@ -20,7 +20,6 @@ type Orm struct {
driver string
whereClause []map[string]interface{}
orClause []map[string]interface{}
notClause []map[string]interface{}
selectStr string
orderStrs []string
offsetStr string
@ -151,11 +150,6 @@ func (s *Orm) Or(querystring interface{}, args ...interface{}) *Orm {
return s
}
func (s *Orm) Not(querystring interface{}, args ...interface{}) *Orm {
s.notClause = append(s.notClause, map[string]interface{}{"query": querystring, "args": args})
return s
}
func (s *Orm) CreateTable(value interface{}) *Orm {
s.explain(value, "CreateTable").Exec()
return s

View File

@ -280,9 +280,4 @@ func TestOrAndNot(t *testing.T) {
if len(users) != 3 {
t.Errorf("Should find three users with name 1 and 3")
}
db.Where("name = ?", "3").Not("age = ?", 22).Find(&users)
if len(users) != 3 {
t.Errorf("Should find three users with name 1 and 3")
}
}

4
sql.go
View File

@ -204,10 +204,6 @@ func (s *Orm) whereSql() (sql string) {
and_conditions = append(and_conditions, s.buildWhereCondition(clause))
}
for _, clause := range s.notClause {
and_conditions = append(and_conditions, "!"+s.buildWhereCondition(clause))
}
for _, clause := range s.orClause {
or_conditions = append(or_conditions, s.buildWhereCondition(clause))
}