Query with raw sql string
(ctx context.Context, s *schema.Schema, query string, arguments []interface{})
| 1013 | |
| 1014 | // Query with raw sql string |
| 1015 | func (tx *Transaction) QueryContext(ctx context.Context, s *schema.Schema, query string, arguments []interface{}) (list []*schema.Resource, err error) { |
| 1016 | defer tx.measureTime(time.Now(), s.ID, "query") |
| 1017 | |
| 1018 | tx.logQuery(query, arguments...) |
| 1019 | rows, err := tx.transaction.QueryxContext(ctx, query, arguments...) |
| 1020 | if err != nil { |
| 1021 | return nil, fmt.Errorf("Failed to run query: %s", query) |
| 1022 | } |
| 1023 | |
| 1024 | defer rows.Close() |
| 1025 | list, err = tx.decodeRows(s, rows, list, false, false) |
| 1026 | if err != nil { |
| 1027 | return nil, err |
| 1028 | } |
| 1029 | |
| 1030 | return |
| 1031 | } |
| 1032 | |
| 1033 | func (tx *Transaction) decodeRows(s *schema.Schema, rows *sqlx.Rows, list []*schema.Resource, skipNil, recursive bool) ([]*schema.Resource, error) { |
| 1034 | for rows.Next() { |
no test coverage detected