MCPcopy
hub / github.com/go-gorm/gorm / Exec

Method Exec

finisher_api.go:784–795  ·  view source on GitHub ↗

Exec executes raw sql

(sql string, values ...interface{})

Source from the content-addressed store, hash-verified

782
783// Exec executes raw sql
784func (db *DB) Exec(sql string, values ...interface{}) (tx *DB) {
785 tx = db.getInstance()
786 tx.Statement.SQL = strings.Builder{}
787
788 if strings.Contains(sql, "@") {
789 clause.NamedExpr{SQL: sql, Vars: values}.Build(tx.Statement)
790 } else {
791 clause.Expr{SQL: sql, Vars: values}.Build(tx.Statement)
792 }
793
794 return tx.callbacks.Raw().Execute(tx)
795}

Callers

nothing calls this directly

Calls 5

getInstanceMethod · 0.95
ContainsMethod · 0.80
ExecuteMethod · 0.80
BuildMethod · 0.65
RawMethod · 0.65

Tested by

no test coverage detected