MCPcopy Create free account
hub / github.com/kataras/iris / Query

Method Query

x/sqlx/sqlx.go:100–112  ·  view source on GitHub ↗

Query is a shortcut of executing a query and bind the result to "dst".

(ctx context.Context, db *sql.DB, dst interface{}, query string, args ...interface{})

Source from the content-addressed store, hash-verified

98
99// Query is a shortcut of executing a query and bind the result to "dst".
100func (s *Schema) Query(ctx context.Context, db *sql.DB, dst interface{}, query string, args ...interface{}) error {
101 rows, err := db.QueryContext(ctx, query, args...)
102 if err != nil {
103 return err
104 }
105
106 if !s.AutoCloseRows { // if not close on bind, we must close it here.
107 defer rows.Close()
108 }
109
110 err = s.Bind(dst, rows)
111 return err
112}
113
114// Bind sets "dst" to the result of "src" and reports any errors.
115func (s *Schema) Bind(dst interface{}, src *sql.Rows) error {

Callers

nothing calls this directly

Calls 2

BindMethod · 0.95
CloseMethod · 0.65

Tested by

no test coverage detected