MCPcopy
hub / github.com/sqldef/sqldef / NewDryRunDatabase

Function NewDryRunDatabase

database/dry_run.go:15–30  ·  view source on GitHub ↗
(db Database)

Source from the content-addressed store, hash-verified

13}
14
15func NewDryRunDatabase(db Database) (*DryRunDatabase, error) {
16 txQueries := db.GetTransactionQueries()
17
18 dryRunDriverName := fmt.Sprintf("dry-run-%p", db) // Unique name per database instance
19 sql.Register(dryRunDriverName, &dryRunDriver{txQueries: txQueries})
20
21 dryRunDB, err := sql.Open(dryRunDriverName, "dry-run")
22 if err != nil {
23 return nil, err
24 }
25
26 return &DryRunDatabase{
27 wrapped: db,
28 dryRunDB: dryRunDB,
29 }, nil
30}
31
32func (d *DryRunDatabase) ExportDDLs() (string, error) {
33 return d.wrapped.ExportDDLs()

Callers 1

RunFunction · 0.92

Calls 2

OpenMethod · 0.80
GetTransactionQueriesMethod · 0.65

Tested by

no test coverage detected