1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
| q.Eq("Name", John)
q.Gt("Age", 7)
q.Lte("Age", 77)
q.Re("Name", "^D")
q.In("Group", []string{"Staff", "Admin"})
q.EqF("FieldName", "SecondFieldName") q.LtF("FieldName", "SecondFieldName") q.GtF("FieldName", "SecondFieldName") q.LteF("FieldName", "SecondFieldName") q.GteF("FieldName", "SecondFieldName")
q.And( q.Gt("Age", 7), q.Re("Name", "^D") )
q.Or( q.Re("Name", "^A"), q.Not( q.Re("Name", "^B") ), q.Re("Name", "^C"), q.In("Group", []string{"Staff", "Admin"}), q.And( q.StrictEq("Password", []byte(password)), q.Eq("Registered", true) ) )
query := db.Select(q.Gte("Age", 7), q.Lte("Age", 77))
query = query.Limit(10).Skip(20).OrderBy("Age").Reverse()
var users []User err = query.Find(&users)
var user User err = query.First(&user)
/ Find all users with an ID between 10 and 100 err = db.Select(q.Gte("ID", 10), q.Lte("ID", 100)).Find(&users)
err = db.Select(q.Or( q.Gt("ID", 50), q.Lt("Age", 21), q.And( q.Eq("Group", "admin"), q.Gte("Age", 21), ), )).Find(&users)
query := db.Select(q.Gte("ID", 10), q.Lte("ID", 100)).Limit(10).Skip(5).Reverse().OrderBy("Age", "Name")
err = query.Find(&users)
err = db.Select(q.Gte("ID", 10), q.Lte("ID", 100)).Limit(10).Skip(5).Reverse().OrderBy("Age", "Name").Find(&users)
err = query.First(&user)
err = db.Select(q.Gte("ID", 10), q.Lte("ID", 100)).Limit(10).Skip(5).Reverse().OrderBy("Age", "Name").First(&user)
err = query.Delete(new(User))
query = db.Select(q.Gte("ID", 10),q.Lte("ID", 100)).OrderBy("Age", "Name")
err = query.Each(new(User), func(record interface{}) error) { u := record.(*User) ... return nil }
|