MCPcopy Create free account
hub / github.com/alexisvisco/amigo / execSQL

Method execSQL

sql_migration.go:48–61  ·  view source on GitHub ↗

execSQL executes SQL within a transaction, either as a single exec or split by statements

(ctx context.Context, tx *sql.Tx, query string)

Source from the content-addressed store, hash-verified

46
47// execSQL executes SQL within a transaction, either as a single exec or split by statements
48func (s SQLMigration) execSQL(ctx context.Context, tx *sql.Tx, query string) error {
49 if !s.splitStatements {
50 _, err := tx.ExecContext(ctx, query)
51 return err
52 }
53
54 statements := splitSQLStatementsWithAnnotations(query)
55 for _, stmt := range statements {
56 if _, err := tx.ExecContext(ctx, stmt); err != nil {
57 return err
58 }
59 }
60 return nil
61}
62
63// execSQLDB executes SQL on a DB, either as a single exec or split by statements
64func (s SQLMigration) execSQLDB(ctx context.Context, db *sql.DB, query string) error {

Callers 2

UpMethod · 0.95
DownMethod · 0.95

Calls 2

ExecContextMethod · 0.45

Tested by

no test coverage detected