MCPcopy
hub / github.com/sqldef/sqldef / sameNormalizedExpr

Method sameNormalizedExpr

schema/generator.go:5731–5746  ·  view source on GitHub ↗

sameNormalizedExpr compares two expressions after normalization, case-sensitively and quote-aware.

(a, b parser.Expr)

Source from the content-addressed store, hash-verified

5729
5730// sameNormalizedExpr compares two expressions after normalization, case-sensitively and quote-aware.
5731func (g *Generator) sameNormalizedExpr(a, b parser.Expr) bool {
5732 if a == nil && b == nil {
5733 return true
5734 }
5735 if a == nil || b == nil {
5736 return false
5737 }
5738
5739 normalizedA := normalizeExpr(a, g.mode)
5740 normalizedB := normalizeExpr(b, g.mode)
5741
5742 if !g.config.LegacyIgnoreQuotes {
5743 return g.formatExprQuoteAware(normalizedA) == g.formatExprQuoteAware(normalizedB)
5744 }
5745 return parser.String(normalizedA) == parser.String(normalizedB)
5746}
5747
5748func (g *Generator) areSameForeignKeys(foreignKeyA ForeignKey, foreignKeyB ForeignKey) bool {
5749 // Compare index columns (source columns of the FK)

Callers 2

areSameWhereClauseMethod · 0.95
areSameExclusionsMethod · 0.95

Calls 3

formatExprQuoteAwareMethod · 0.95
StringFunction · 0.92
normalizeExprFunction · 0.85

Tested by

no test coverage detected