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.
71 lines
2.1 KiB
71 lines
2.1 KiB
8 years ago
|
// 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
|
||
|
|
||
6 years ago
|
import "xorm.io/builder"
|
||
8 years ago
|
|
||
|
// 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.
|
||
|
//
|
||
|
// Deprecated: use SQL instead.
|
||
|
func (session *Session) Sql(query string, args ...interface{}) *Session {
|
||
|
return session.SQL(query, args...)
|
||
|
}
|
||
|
|
||
|
// 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 {
|
||
7 years ago
|
session.statement.SQL(query, args...)
|
||
8 years ago
|
return session
|
||
|
}
|
||
|
|
||
|
// Where provides custom query condition.
|
||
|
func (session *Session) Where(query interface{}, args ...interface{}) *Session {
|
||
7 years ago
|
session.statement.Where(query, args...)
|
||
8 years ago
|
return session
|
||
|
}
|
||
|
|
||
|
// And provides custom query condition.
|
||
|
func (session *Session) And(query interface{}, args ...interface{}) *Session {
|
||
7 years ago
|
session.statement.And(query, args...)
|
||
8 years ago
|
return session
|
||
|
}
|
||
|
|
||
|
// Or provides custom query condition.
|
||
|
func (session *Session) Or(query interface{}, args ...interface{}) *Session {
|
||
7 years ago
|
session.statement.Or(query, args...)
|
||
8 years ago
|
return session
|
||
|
}
|
||
|
|
||
|
// Id provides converting id as a query condition
|
||
|
//
|
||
|
// Deprecated: use ID instead
|
||
|
func (session *Session) Id(id interface{}) *Session {
|
||
|
return session.ID(id)
|
||
|
}
|
||
|
|
||
|
// ID provides converting id as a query condition
|
||
|
func (session *Session) ID(id interface{}) *Session {
|
||
7 years ago
|
session.statement.ID(id)
|
||
8 years ago
|
return session
|
||
|
}
|
||
|
|
||
|
// In provides a query string like "id in (1, 2, 3)"
|
||
|
func (session *Session) In(column string, args ...interface{}) *Session {
|
||
7 years ago
|
session.statement.In(column, args...)
|
||
8 years ago
|
return session
|
||
|
}
|
||
|
|
||
|
// NotIn provides a query string like "id in (1, 2, 3)"
|
||
|
func (session *Session) NotIn(column string, args ...interface{}) *Session {
|
||
7 years ago
|
session.statement.NotIn(column, args...)
|
||
8 years ago
|
return session
|
||
|
}
|
||
|
|
||
7 years ago
|
// Conds returns session query conditions except auto bean conditions
|
||
8 years ago
|
func (session *Session) Conds() builder.Cond {
|
||
7 years ago
|
return session.statement.cond
|
||
8 years ago
|
}
|