1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-23 02:38:35 +00:00

Upgrade xorm to v1.1.0 (#15869)

This commit is contained in:
Lunny Xiao
2021-05-15 03:17:06 +08:00
committed by GitHub
parent e2f39c2b64
commit f6be429781
55 changed files with 1309 additions and 438 deletions

View File

@@ -16,10 +16,10 @@ type Quoter struct {
}
var (
// AlwaysFalseReverse always think it's not a reverse word
// AlwaysNoReserve always think it's not a reverse word
AlwaysNoReserve = func(string) bool { return false }
// AlwaysReverse always reverse the word
// AlwaysReserve always reverse the word
AlwaysReserve = func(string) bool { return true }
// CommanQuoteMark represnets the common quote mark
@@ -29,10 +29,12 @@ var (
CommonQuoter = Quoter{CommanQuoteMark, CommanQuoteMark, AlwaysReserve}
)
// IsEmpty return true if no prefix and suffix
func (q Quoter) IsEmpty() bool {
return q.Prefix == 0 && q.Suffix == 0
}
// Quote quote a string
func (q Quoter) Quote(s string) string {
var buf strings.Builder
q.QuoteTo(&buf, s)
@@ -59,12 +61,14 @@ func (q Quoter) Trim(s string) string {
return buf.String()
}
// Join joins a slice with quoters
func (q Quoter) Join(a []string, sep string) string {
var b strings.Builder
q.JoinWrite(&b, a, sep)
return b.String()
}
// JoinWrite writes quoted content to a builder
func (q Quoter) JoinWrite(b *strings.Builder, a []string, sep string) error {
if len(a) == 0 {
return nil