MCPcopy
hub / github.com/sqldef/sqldef / parseExclusion

Function parseExclusion

schema/parser.go:1013–1037  ·  view source on GitHub ↗
(exclusion *parser.ExclusionDefinition)

Source from the content-addressed store, hash-verified

1011}
1012
1013func parseExclusion(exclusion *parser.ExclusionDefinition) Exclusion {
1014 var exs []ExclusionPair
1015 for _, exclusion := range exclusion.Exclusions {
1016 exs = append(exs, ExclusionPair{
1017 expression: exclusion.Expression,
1018 operator: exclusion.Operator,
1019 })
1020 }
1021 var where parser.Expr
1022 if exclusion.Where != nil {
1023 where = exclusion.Where.Expr
1024 }
1025 // PostgreSQL defaults to btree when no index method is specified
1026 // Normalize to lowercase to match PostgreSQL's pg_get_constraintdef output
1027 indexType := strings.ToLower(exclusion.IndexType.Name)
1028 if indexType == "" {
1029 indexType = "btree"
1030 }
1031 return Exclusion{
1032 constraintName: exclusion.ConstraintName,
1033 indexType: indexType,
1034 exclusions: exs,
1035 where: where,
1036 }
1037}
1038
1039// normalizeQualifiedName creates a QualifiedName from a parser.TableName
1040func normalizeQualifiedName(mode GeneratorMode, tableName parser.TableName, defaultSchema string) QualifiedName {

Callers 2

parseDDLFunction · 0.85
parseTableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected