You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

session_cond.go 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright 2017 The Xorm Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package xorm
  5. import "xorm.io/builder"
  6. // SQL provides raw sql input parameter. When you have a complex SQL statement
  7. // and cannot use Where, Id, In and etc. Methods to describe, you can use SQL.
  8. func (session *Session) SQL(query interface{}, args ...interface{}) *Session {
  9. session.statement.SQL(query, args...)
  10. return session
  11. }
  12. // Where provides custom query condition.
  13. func (session *Session) Where(query interface{}, args ...interface{}) *Session {
  14. session.statement.Where(query, args...)
  15. return session
  16. }
  17. // And provides custom query condition.
  18. func (session *Session) And(query interface{}, args ...interface{}) *Session {
  19. session.statement.And(query, args...)
  20. return session
  21. }
  22. // Or provides custom query condition.
  23. func (session *Session) Or(query interface{}, args ...interface{}) *Session {
  24. session.statement.Or(query, args...)
  25. return session
  26. }
  27. // ID provides converting id as a query condition
  28. func (session *Session) ID(id interface{}) *Session {
  29. session.statement.ID(id)
  30. return session
  31. }
  32. // In provides a query string like "id in (1, 2, 3)"
  33. func (session *Session) In(column string, args ...interface{}) *Session {
  34. session.statement.In(column, args...)
  35. return session
  36. }
  37. // NotIn provides a query string like "id in (1, 2, 3)"
  38. func (session *Session) NotIn(column string, args ...interface{}) *Session {
  39. session.statement.NotIn(column, args...)
  40. return session
  41. }
  42. // Conds returns session query conditions except auto bean conditions
  43. func (session *Session) Conds() builder.Cond {
  44. return session.statement.Conds()
  45. }