2017-04-07 07:17:25 +05:30
|
|
|
// Copyright 2017 The Xorm Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package xorm
|
|
|
|
|
2019-06-23 20:52:43 +05:30
|
|
|
import "xorm.io/builder"
|
2017-04-07 07:17:25 +05:30
|
|
|
|
|
|
|
// SQL provides raw sql input parameter. When you have a complex SQL statement
|
|
|
|
// and cannot use Where, Id, In and etc. Methods to describe, you can use SQL.
|
|
|
|
func (session *Session) SQL(query interface{}, args ...interface{}) *Session {
|
2017-08-22 17:09:52 +05:30
|
|
|
session.statement.SQL(query, args...)
|
2017-04-07 07:17:25 +05:30
|
|
|
return session
|
|
|
|
}
|
|
|
|
|
|
|
|
// Where provides custom query condition.
|
|
|
|
func (session *Session) Where(query interface{}, args ...interface{}) *Session {
|
2017-08-22 17:09:52 +05:30
|
|
|
session.statement.Where(query, args...)
|
2017-04-07 07:17:25 +05:30
|
|
|
return session
|
|
|
|
}
|
|
|
|
|
|
|
|
// And provides custom query condition.
|
|
|
|
func (session *Session) And(query interface{}, args ...interface{}) *Session {
|
2017-08-22 17:09:52 +05:30
|
|
|
session.statement.And(query, args...)
|
2017-04-07 07:17:25 +05:30
|
|
|
return session
|
|
|
|
}
|
|
|
|
|
|
|
|
// Or provides custom query condition.
|
|
|
|
func (session *Session) Or(query interface{}, args ...interface{}) *Session {
|
2017-08-22 17:09:52 +05:30
|
|
|
session.statement.Or(query, args...)
|
2017-04-07 07:17:25 +05:30
|
|
|
return session
|
|
|
|
}
|
|
|
|
|
|
|
|
// ID provides converting id as a query condition
|
|
|
|
func (session *Session) ID(id interface{}) *Session {
|
2017-08-22 17:09:52 +05:30
|
|
|
session.statement.ID(id)
|
2017-04-07 07:17:25 +05:30
|
|
|
return session
|
|
|
|
}
|
|
|
|
|
|
|
|
// In provides a query string like "id in (1, 2, 3)"
|
|
|
|
func (session *Session) In(column string, args ...interface{}) *Session {
|
2017-08-22 17:09:52 +05:30
|
|
|
session.statement.In(column, args...)
|
2017-04-07 07:17:25 +05:30
|
|
|
return session
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotIn provides a query string like "id in (1, 2, 3)"
|
|
|
|
func (session *Session) NotIn(column string, args ...interface{}) *Session {
|
2017-08-22 17:09:52 +05:30
|
|
|
session.statement.NotIn(column, args...)
|
2017-04-07 07:17:25 +05:30
|
|
|
return session
|
|
|
|
}
|
|
|
|
|
2017-08-22 17:09:52 +05:30
|
|
|
// Conds returns session query conditions except auto bean conditions
|
2017-04-07 07:17:25 +05:30
|
|
|
func (session *Session) Conds() builder.Cond {
|
2020-03-22 20:42:55 +05:30
|
|
|
return session.statement.Conds()
|
2017-04-07 07:17:25 +05:30
|
|
|
}
|