Skip to content

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
xormplus committed May 6, 2016
1 parent ada83a1 commit a293180
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
14 changes: 0 additions & 14 deletions engineplus.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,6 @@ func (engine *Engine) GetFirst(bean interface{}) ResultBean {
return session.GetFirst(bean)
}

// Exec a raw sql and return records as []map[string]interface{}
func (engine *Engine) QueryAll(sql string, paramStr ...interface{}) (resultsSlice []map[string]interface{}, err error) {
session := engine.NewSession()
defer session.Close()
return session.queryAll(sql, paramStr...)
}

// Exec a raw sql and return records as []map[string]interface{}
func (engine *Engine) QueryAllByMap(sql string, paramMap interface{}) (resultsSlice []map[string]interface{}, err error) {
session := engine.NewSession()
defer session.Close()
return session.queryAllByMap(sql, paramMap)
}

func JSONString(v interface{}, IndentJSON bool) (string, error) {
var result []byte
var err error
Expand Down
19 changes: 18 additions & 1 deletion sessionplus.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"fmt"
"reflect"
"regexp"
"strings"
"strconv"
"strings"
"time"

"github.com/Chronokeeper/anyxml"
Expand Down Expand Up @@ -196,6 +196,23 @@ func (resultStructs ResultStructs) XmlIndent(prefix string, indent string, recor
return string(resultByte), nil
}

func (session *Session) SqlMapClient(sqlTagName string, args ...interface{}) *Session {
return session.Sql(session.Engine.SqlMap.Sql[sqlTagName], args...)
}

func (session *Session) SqlTemplateClient(sqlTagName string, args ...interface{}) *Session {
map1 := args[0].(map[string]interface{})
if session.Engine.SqlTemplate.Template[sqlTagName] == nil {
return session.Sql("", &map1)
}
sql, err := session.Engine.SqlTemplate.Template[sqlTagName].Execute(map1)
if err != nil {
session.Engine.logger.Error(err)
}

return session.Sql(sql, &map1)
}

func (session *Session) Find(rowsSlicePtr interface{}, condiBean ...interface{}) ResultStructs {
err := session.find(rowsSlicePtr, condiBean...)
r := ResultStructs{Result: rowsSlicePtr, Error: err}
Expand Down

0 comments on commit a293180

Please sign in to comment.