MCPcopy
hub / github.com/sqldef/sqldef / parseFkAction

Method parseFkAction

database/postgres/parser.go:1146–1164  ·  view source on GitHub ↗
(action string)

Source from the content-addressed store, hash-verified

1144}
1145
1146func (p PostgresParser) parseFkAction(action string) parser.Ident {
1147 // https://github.com/pganalyze/pg_query_go/blob/v2.2.0/parser/include/nodes/parsenodes.h#L2145-L2149C23
1148 switch action {
1149 case "a":
1150 // pgquery cannot distinguish between unspecified action and no action.
1151 // Empty for no action to match existing behavior.
1152 return parser.NewIdent("", false)
1153 case "r":
1154 return parser.NewIdent("RESTRICT", false)
1155 case "c":
1156 return parser.NewIdent("CASCADE", false)
1157 case "n":
1158 return parser.NewIdent("SET NULL", false)
1159 case "d":
1160 return parser.NewIdent("SET DEFAULT", false)
1161 default:
1162 return parser.NewIdent("", false)
1163 }
1164}
1165
1166func (p PostgresParser) parseColumnDef(columnDef *pgquery.ColumnDef, tableName parser.TableName) (*parser.ColumnDefinition, *parser.ForeignKeyDefinition, error) {
1167 if columnDef.Inhcount != 0 || columnDef.Identity != "" || columnDef.Generated != "" || columnDef.Storage != "" || columnDef.CollClause != nil {

Callers 1

parseForeignKeyMethod · 0.95

Calls 1

NewIdentFunction · 0.92

Tested by

no test coverage detected