5.2. Override default behavior APIs

  • NoAutoTime()

No auto timestamp for Created and Updated fields for INSERT and UPDATE

  • NoCache()

Disable cache lookup

  • NoAutoCondition()

Disable auto generate condition from bean. For example:

engine.Where("name = ?", "lunny").Get(&User{Id:1})
// SELECT * FROM user where name='lunny' AND id = 1 LIMIT 1
engine.Where("name = ?", "lunny").NoAutoCondition().Get(&User{Id:1})
// SELECT * FROM user where name='lunny' LIMIT 1
  • UseBool(…string)

xorm’s default behavior is fields with 0, “”, nil, false, will not be used during query or update, use this method to explicit specify bool type fields for query or update

  • Cascade(bool)

Do cascade lookup for associations