MCPcopy Create free account
hub / github.com/dolthub/doltgresql / RowIter

Method RowIter

server/tables/pgcatalog/pg_database.go:49–71  ·  view source on GitHub ↗

RowIter implements the interface tables.Handler.

(ctx *sql.Context, partition sql.Partition)

Source from the content-addressed store, hash-verified

47
48// RowIter implements the interface tables.Handler.
49func (p PgDatabaseHandler) RowIter(ctx *sql.Context, partition sql.Partition) (sql.RowIter, error) {
50 // TODO: Should the catalog be passed to RowIter like it is for the information_schema tables RowIter?
51 doltSession := dsess.DSessFromSess(ctx.Session)
52 c := sqle.NewDefault(doltSession.Provider()).Analyzer.Catalog
53
54 databases := c.AllDatabases(ctx)
55 dbs := make([]sql.Database, 0, len(databases))
56 for _, db := range databases {
57 name := db.Name()
58 if name == "information_schema" || name == "pg_catalog" || name == "performance_schema" {
59 continue
60 }
61 dbs = append(dbs, db)
62 }
63 sort.Slice(dbs, func(i, j int) bool {
64 return dbs[i].Name() < dbs[j].Name()
65 })
66
67 return &pgDatabaseRowIter{
68 dbs: dbs,
69 idx: 0,
70 }, nil
71}
72
73// PkSchema implements the interface tables.Handler.
74func (p PgDatabaseHandler) PkSchema() sql.PrimaryKeySchema {

Callers

nothing calls this directly

Calls 2

AllDatabasesMethod · 0.80
NameMethod · 0.65

Tested by

no test coverage detected