MCPcopy Index your code
hub / github.com/upper/db / WithSession

Function WithSession

internal/sqlbuilder/builder.go:100–108  ·  view source on GitHub ↗

WithSession returns a query builder that is bound to the given database session.

(sess interface{}, t *exql.Template)

Source from the content-addressed store, hash-verified

98
99// WithSession returns a query builder that is bound to the given database session.
100func 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.
111func WithTemplate(t *exql.Template) db.SQL {

Callers 1

SQLMethod · 0.92

Calls 1

newTemplateWithUtilsFunction · 0.85

Tested by

no test coverage detected