MCPcopy
hub / github.com/sqldef/sqldef / parsePartitionOf

Function parsePartitionOf

schema/parser.go:349–371  ·  view source on GitHub ↗

parsePartitionOf handles CREATE TABLE ... PARTITION OF statements

(mode GeneratorMode, stmt *parser.DDL, defaultSchema string, rawDDL string)

Source from the content-addressed store, hash-verified

347
348// parsePartitionOf handles CREATE TABLE ... PARTITION OF statements
349func parsePartitionOf(mode GeneratorMode, stmt *parser.DDL, defaultSchema string, rawDDL string) (*CreatePartitionOf, error) {
350 tableName := normalizeQualifiedName(mode, stmt.NewName, defaultSchema)
351 parentTable := normalizeQualifiedName(mode, stmt.PartitionOf.ParentTable, defaultSchema)
352
353 bound := PartitionBound{}
354 if stmt.PartitionOf.BoundSpec != nil {
355 if stmt.PartitionOf.BoundSpec.IsDefault {
356 bound.IsDefault = true
357 } else if stmt.PartitionOf.BoundSpec.In != nil {
358 bound.In = stmt.PartitionOf.BoundSpec.In
359 } else if stmt.PartitionOf.BoundSpec.From != nil {
360 bound.From = stmt.PartitionOf.BoundSpec.From
361 bound.To = stmt.PartitionOf.BoundSpec.To
362 }
363 }
364
365 return &CreatePartitionOf{
366 statement: rawDDL,
367 tableName: tableName,
368 parentTable: parentTable,
369 boundSpec: bound,
370 }, nil
371}
372
373func parseTable(mode GeneratorMode, stmt *parser.DDL, defaultSchema string, rawDDL string) (Table, error) {
374 var columns = map[string]*Column{}

Callers 1

parseDDLFunction · 0.85

Calls 1

normalizeQualifiedNameFunction · 0.85

Tested by

no test coverage detected