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

Function WrapSqlDatabase

server/tables/pg_database.go:57–65  ·  view source on GitHub ↗

WrapSqlDatabase wraps any Dolt database variant as a Pg-aware database. ReadOnlyDatabase embeds sqle.Database by value, so a plain sqle.Database type assertion does not match it; this function handles both cases.

(db sql.Database)

Source from the content-addressed store, hash-verified

55// ReadOnlyDatabase embeds sqle.Database by value, so a plain sqle.Database type
56// assertion does not match it; this function handles both cases.
57func WrapSqlDatabase(db sql.Database) sql.Database {
58 if rodb, ok := db.(sqle.ReadOnlyDatabase); ok {
59 return &PgReadOnlyDatabase{rodb}
60 }
61 if sdb, ok := db.(sqle.Database); ok {
62 return WrapSqleDatabase(sdb)
63 }
64 return db
65}
66
67// applySchemaWrap wraps a single schema returned by the underlying sqle.Database methods.
68// System schemas (those with registered virtual-table handlers) get a Database wrapper

Callers 4

DatabaseMethod · 0.92
AllDatabasesMethod · 0.92
IterateDatabaseFunction · 0.92
RunCallbackFunction · 0.92

Calls 1

WrapSqleDatabaseFunction · 0.85

Tested by

no test coverage detected