mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
@@ -1924,7 +1924,7 @@ func (b *Builder) Quote(ident string) string {
|
||||
// If it was quoted with the wrong
|
||||
// identifier character.
|
||||
if strings.Contains(ident, "`") {
|
||||
return strings.Replace(ident, "`", `"`, -1)
|
||||
return strings.ReplaceAll(ident, "`", `"`)
|
||||
}
|
||||
return strconv.Quote(ident)
|
||||
// An identifier for unknown dialect.
|
||||
@@ -1944,7 +1944,7 @@ func (b *Builder) Ident(s string) *Builder {
|
||||
case (isFunc(s) || isModifier(s)) && b.postgres():
|
||||
// Modifiers and aggregation functions that
|
||||
// were called without dialect information.
|
||||
b.WriteString(strings.Replace(s, "`", `"`, -1))
|
||||
b.WriteString(strings.ReplaceAll(s, "`", `"`))
|
||||
default:
|
||||
b.WriteString(s)
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ func (c *Column) defaultValue(b *sql.ColumnBuilder) {
|
||||
attr += strconv.FormatBool(v)
|
||||
case string:
|
||||
// Escape single quote by replacing each with 2.
|
||||
attr += fmt.Sprintf("'%s'", strings.Replace(v, "'", "''", -1))
|
||||
attr += fmt.Sprintf("'%s'", strings.ReplaceAll(v, "'", "''"))
|
||||
default:
|
||||
attr += fmt.Sprint(v)
|
||||
}
|
||||
@@ -361,7 +361,7 @@ func (r ReferenceOption) ConstName() string {
|
||||
if r == NoAction {
|
||||
return ""
|
||||
}
|
||||
return strings.Replace(strings.Title(strings.ToLower(string(r))), " ", "", -1)
|
||||
return strings.ReplaceAll(strings.Title(strings.ToLower(string(r))), " ", "")
|
||||
}
|
||||
|
||||
// Index definition for table index.
|
||||
|
||||
Reference in New Issue
Block a user