expose Session.Query2 and add Engine.QueryMapString by using Session.Query2
- add Query a raw sql and return records as []map[string]string
This commit is contained in:
parent
dddc985b86
commit
0b6a0b06a6
|
@ -1479,6 +1479,13 @@ func (engine *Engine) Query(sql string, paramStr ...interface{}) (resultsSlice [
|
|||
return session.Query(sql, paramStr...)
|
||||
}
|
||||
|
||||
// Query a raw sql and return records as []map[string]string
|
||||
func (engine *Engine) QueryMapString(sql string, paramStr ...interface{}) (resultsSlice []map[string]string, err error) {
|
||||
session := engine.NewSession()
|
||||
defer session.Close()
|
||||
return session.Query2(sql, paramStr...)
|
||||
}
|
||||
|
||||
// Insert one or more records
|
||||
func (engine *Engine) Insert(beans ...interface{}) (int64, error) {
|
||||
session := engine.NewSession()
|
||||
|
|
|
@ -2182,7 +2182,7 @@ func (session *Session) Query(sqlStr string, paramStr ...interface{}) (resultsSl
|
|||
// =============================
|
||||
// for string
|
||||
// =============================
|
||||
func (session *Session) query2(sqlStr string, paramStr ...interface{}) (resultsSlice []map[string]string, err error) {
|
||||
func (session *Session) Query2(sqlStr string, paramStr ...interface{}) (resultsSlice []map[string]string, err error) {
|
||||
session.queryPreprocess(&sqlStr, paramStr...)
|
||||
|
||||
if session.IsAutoCommit {
|
||||
|
|
Loading…
Reference in New Issue