MCPcopy Index your code
hub / github.com/sqlc-dev/sqlc / dropSchema

Method dropSchema

internal/sql/catalog/schema.go:116–134  ·  view source on GitHub ↗
(stmt *ast.DropSchemaStmt)

Source from the content-addressed store, hash-verified

114}
115
116func (c *Catalog) dropSchema(stmt *ast.DropSchemaStmt) error {
117 // TODO: n^2 in the worst-case
118 for _, name := range stmt.Schemas {
119 idx := -1
120 for i := range c.Schemas {
121 if c.Schemas[i].Name == name.Str {
122 idx = i
123 }
124 }
125 if idx == -1 {
126 if stmt.MissingOk {
127 continue
128 }
129 return sqlerr.SchemaNotFound(name.Str)
130 }
131 c.Schemas = append(c.Schemas[:idx], c.Schemas[idx+1:]...)
132 }
133 return nil
134}

Callers 1

UpdateMethod · 0.95

Calls 1

SchemaNotFoundFunction · 0.92

Tested by

no test coverage detected