WithSession returns a query builder that is bound to the given database session.
(sess interface{}, t *exql.Template)
| 98 | |
| 99 | // WithSession returns a query builder that is bound to the given database session. |
| 100 | func WithSession(sess interface{}, t *exql.Template) db.SQL { |
| 101 | if sqlDB, ok := sess.(*sql.DB); ok { |
| 102 | sess = sqlDB |
| 103 | } |
| 104 | return &sqlBuilder{ |
| 105 | sess: sess.(exprDB), // Let it panic, it will show the developer an informative error. |
| 106 | t: newTemplateWithUtils(t), |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | // WithTemplate returns a builder that is based on the given template. |
| 111 | func WithTemplate(t *exql.Template) db.SQL { |
no test coverage detected