MCPcopy Index your code
hub / github.com/ent/ent / tableExist

Method tableExist

dialect/sql/schema/mysql.go:55–62  ·  view source on GitHub ↗
(ctx context.Context, conn dialect.ExecQuerier, name string)

Source from the content-addressed store, hash-verified

53}
54
55func (d *MySQL) tableExist(ctx context.Context, conn dialect.ExecQuerier, name string) (bool, error) {
56 query, args := sql.Select(sql.Count("*")).From(sql.Table("TABLES").Schema("INFORMATION_SCHEMA")).
57 Where(sql.And(
58 d.matchSchema(),
59 sql.EQ("TABLE_NAME", name),
60 )).Query()
61 return exist(ctx, conn, query, args...)
62}
63
64// matchSchema returns the predicate for matching table schema.
65func (d *MySQL) matchSchema(columns ...string) *sql.Predicate {

Callers

nothing calls this directly

Calls 11

matchSchemaMethod · 0.95
SelectFunction · 0.92
CountFunction · 0.92
TableFunction · 0.92
AndFunction · 0.92
EQFunction · 0.92
existFunction · 0.85
QueryMethod · 0.65
WhereMethod · 0.65
FromMethod · 0.45
SchemaMethod · 0.45

Tested by

no test coverage detected