To support sql comment. #1344
|
@ -57,6 +57,7 @@ type Session struct {
|
|||
//beforeSQLExec func(string, ...interface{})
|
||||
lastSQL string
|
||||
lastSQLArgs []interface{}
|
||||
comment string
|
||||
|
||||
ctx context.Context
|
||||
sessionType sessionType
|
||||
|
@ -157,6 +158,12 @@ func (session *Session) Table(tableNameOrBean interface{}) *Session {
|
|||
return session
|
||||
}
|
||||
|
||||
// Set comment for select statement
|
||||
func (session *Session) Comment(comment string) *Session {
|
||||
session.comment = comment
|
||||
return session
|
||||
}
|
||||
|
||||
// Alias set the table alias
|
||||
func (session *Session) Alias(alias string) *Session {
|
||||
session.statement.Alias(alias)
|
||||
|
|
|
@ -20,6 +20,7 @@ func (session *Session) genQuerySQL(sqlOrArgs ...interface{}) (string, []interfa
|
|||
return convertSQLOrArgs(sqlOrArgs...)
|
||||
}
|
||||
|
||||
sqlStr = session.comment + sqlStr
|
||||
if session.statement.RawSQL != "" {
|
||||
return session.statement.RawSQL, session.statement.RawParams, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user