diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-05-15 03:17:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-14 20:17:06 +0100 |
commit | f6be429781b24b1ac3b6e719b9c64df33866db93 (patch) | |
tree | dec0c6c9fb4f4d146f76b96f463a448494bcd010 /vendor/xorm.io/xorm/schemas/quote.go | |
parent | e2f39c2b64e1c5360702e507e0cac56255ca61c3 (diff) | |
download | gitea-f6be429781b24b1ac3b6e719b9c64df33866db93.tar.gz gitea-f6be429781b24b1ac3b6e719b9c64df33866db93.zip |
Upgrade xorm to v1.1.0 (#15869)
Diffstat (limited to 'vendor/xorm.io/xorm/schemas/quote.go')
-rw-r--r-- | vendor/xorm.io/xorm/schemas/quote.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/vendor/xorm.io/xorm/schemas/quote.go b/vendor/xorm.io/xorm/schemas/quote.go index a0070048a0..71040ad9c7 100644 --- a/vendor/xorm.io/xorm/schemas/quote.go +++ b/vendor/xorm.io/xorm/schemas/quote.go @@ -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 |