mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
Hide not allowed Reactions (#9387)
* Hide not allowed Reactions * filter in query :D * use ` Co-Authored-By: Alexey 〒erentyev <axifnx@gmail.com> * update xorm v0.8.0 -> v0.8.1
This commit is contained in:
parent
3b4682e172
commit
6d811bcb14
10 changed files with 156 additions and 478 deletions
24
vendor/xorm.io/xorm/session.go
generated
vendored
24
vendor/xorm.io/xorm/session.go
generated
vendored
|
@ -57,6 +57,7 @@ type Session struct {
|
|||
//beforeSQLExec func(string, ...interface{})
|
||||
lastSQL string
|
||||
lastSQLArgs []interface{}
|
||||
showSQL bool
|
||||
|
||||
ctx context.Context
|
||||
sessionType sessionType
|
||||
|
@ -72,6 +73,7 @@ func (session *Session) Clone() *Session {
|
|||
func (session *Session) Init() {
|
||||
session.statement.Init()
|
||||
session.statement.Engine = session.engine
|
||||
session.showSQL = session.engine.showSQL
|
||||
session.isAutoCommit = true
|
||||
session.isCommitedOrRollbacked = false
|
||||
session.isAutoClose = false
|
||||
|
@ -226,6 +228,16 @@ func (session *Session) Cascade(trueOrFalse ...bool) *Session {
|
|||
return session
|
||||
}
|
||||
|
||||
// MustLogSQL means record SQL or not and don't follow engine's setting
|
||||
func (session *Session) MustLogSQL(log ...bool) *Session {
|
||||
if len(log) > 0 {
|
||||
session.showSQL = log[0]
|
||||
} else {
|
||||
session.showSQL = true
|
||||
}
|
||||
return session
|
||||
}
|
||||
|
||||
// NoCache ask this session do not retrieve data from cache system and
|
||||
// get data from database directly.
|
||||
func (session *Session) NoCache() *Session {
|
||||
|
@ -842,7 +854,17 @@ func (session *Session) slice2Bean(scanResults []interface{}, fields []string, b
|
|||
func (session *Session) saveLastSQL(sql string, args ...interface{}) {
|
||||
session.lastSQL = sql
|
||||
session.lastSQLArgs = args
|
||||
session.engine.logSQL(sql, args...)
|
||||
session.logSQL(sql, args...)
|
||||
}
|
||||
|
||||
func (session *Session) logSQL(sqlStr string, sqlArgs ...interface{}) {
|
||||
if session.showSQL && !session.engine.showExecTime {
|
||||
if len(sqlArgs) > 0 {
|
||||
session.engine.logger.Infof("[SQL] %v %#v", sqlStr, sqlArgs)
|
||||
} else {
|
||||
session.engine.logger.Infof("[SQL] %v", sqlStr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// LastSQL returns last query information
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue