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)
| 55 | // ReadOnlyDatabase embeds sqle.Database by value, so a plain sqle.Database type |
| 56 | // assertion does not match it; this function handles both cases. |
| 57 | func 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 |
no test coverage detected