(exclusion *parser.ExclusionDefinition)
| 1011 | } |
| 1012 | |
| 1013 | func 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 |
| 1040 | func normalizeQualifiedName(mode GeneratorMode, tableName parser.TableName, defaultSchema string) QualifiedName { |
no outgoing calls
no test coverage detected