MCPcopy
hub / github.com/ent/ent / Ident

Method Ident

dialect/sql/builder.go:2982–2998  ·  view source on GitHub ↗

Ident appends the given string as an identifier.

(s string)

Source from the content-addressed store, hash-verified

2980
2981// Ident appends the given string as an identifier.
2982func (b *Builder) Ident(s string) *Builder {
2983 switch {
2984 case len(s) == 0:
2985 case !strings.HasSuffix(s, "*") && !b.isIdent(s) && !isFunc(s) && !isModifier(s) && !isAlias(s):
2986 if b.qualifier != "" {
2987 b.WriteString(b.Quote(b.qualifier)).WriteByte('.')
2988 }
2989 b.WriteString(b.Quote(s))
2990 case (isFunc(s) || isModifier(s) || isAlias(s)) && b.postgres():
2991 // Modifiers and aggregation functions that
2992 // were called without dialect information.
2993 b.WriteString(strings.ReplaceAll(s, "`", `"`))
2994 default:
2995 b.WriteString(s)
2996 }
2997 return b
2998}
2999
3000// IdentComma calls Ident on all arguments and adds a comma between them.
3001func (b *Builder) IdentComma(s ...string) *Builder {

Callers 15

AsFunction · 0.95
CMethod · 0.95
refMethod · 0.95
CMethod · 0.95
AscFunction · 0.95
DescFunction · 0.95
CMethod · 0.95
IdentCommaMethod · 0.95
writeSchemaMethod · 0.95
NicknameSearchFunction · 0.80
NameGlobFunction · 0.80
TestBuilderFunction · 0.80

Calls 9

isIdentMethod · 0.95
WriteStringMethod · 0.95
QuoteMethod · 0.95
postgresMethod · 0.95
isFuncFunction · 0.85
isModifierFunction · 0.85
isAliasFunction · 0.85
HasSuffixMethod · 0.80
WriteByteMethod · 0.80

Tested by 7

NicknameSearchFunction · 0.64
TestBuilderFunction · 0.64
TestSelector_OrderByExprFunction · 0.64
TestSelector_SelectExprFunction · 0.64
TestLimitNeighborsFunction · 0.64