Expose internal jet.Rows type
This commit is contained in:
parent
c049675831
commit
a428981a2d
7 changed files with 22 additions and 4 deletions
|
|
@ -30,7 +30,7 @@ type Statement interface {
|
||||||
Rows(ctx context.Context, db qrm.Queryable) (*Rows, error)
|
Rows(ctx context.Context, db qrm.Queryable) (*Rows, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rows wraps sql.Rows type to add query result mapping for Scan method
|
// Rows wraps sql.Rows type with a support for query result mapping
|
||||||
type Rows struct {
|
type Rows struct {
|
||||||
*sql.Rows
|
*sql.Rows
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ import "github.com/go-jet/jet/v2/internal/jet"
|
||||||
// Statement is common interface for all statements(SELECT, INSERT, UPDATE, DELETE, LOCK)
|
// Statement is common interface for all statements(SELECT, INSERT, UPDATE, DELETE, LOCK)
|
||||||
type Statement = jet.Statement
|
type Statement = jet.Statement
|
||||||
|
|
||||||
|
// Rows wraps sql.Rows type with a support for query result mapping
|
||||||
|
type Rows = jet.Rows
|
||||||
|
|
||||||
// Projection is interface for all projection types. Types that can be part of, for instance SELECT clause.
|
// Projection is interface for all projection types. Types that can be part of, for instance SELECT clause.
|
||||||
type Projection = jet.Projection
|
type Projection = jet.Projection
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ import "github.com/go-jet/jet/v2/internal/jet"
|
||||||
// Statement is common interface for all statements(SELECT, INSERT, UPDATE, DELETE, LOCK)
|
// Statement is common interface for all statements(SELECT, INSERT, UPDATE, DELETE, LOCK)
|
||||||
type Statement = jet.Statement
|
type Statement = jet.Statement
|
||||||
|
|
||||||
|
// Rows wraps sql.Rows type with a support for query result mapping
|
||||||
|
type Rows = jet.Rows
|
||||||
|
|
||||||
// Projection is interface for all projection types. Types that can be part of, for instance SELECT clause.
|
// Projection is interface for all projection types. Types that can be part of, for instance SELECT clause.
|
||||||
type Projection = jet.Projection
|
type Projection = jet.Projection
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ import "github.com/go-jet/jet/v2/internal/jet"
|
||||||
// Statement is common interface for all statements(SELECT, INSERT, UPDATE, DELETE, LOCK)
|
// Statement is common interface for all statements(SELECT, INSERT, UPDATE, DELETE, LOCK)
|
||||||
type Statement = jet.Statement
|
type Statement = jet.Statement
|
||||||
|
|
||||||
|
// Rows wraps sql.Rows type with a support for query result mapping
|
||||||
|
type Rows = jet.Rows
|
||||||
|
|
||||||
// Projection is interface for all projection types. Types that can be part of, for instance SELECT clause.
|
// Projection is interface for all projection types. Types that can be part of, for instance SELECT clause.
|
||||||
type Projection = jet.Projection
|
type Projection = jet.Projection
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,10 @@ func TestRawStatementRows(t *testing.T) {
|
||||||
FROM dvds.actor
|
FROM dvds.actor
|
||||||
ORDER BY actor.actor_id`)
|
ORDER BY actor.actor_id`)
|
||||||
|
|
||||||
rows, err := stmt.Rows(context.Background(), db)
|
var rows *Rows
|
||||||
|
var err error
|
||||||
|
|
||||||
|
rows, err = stmt.Rows(context.Background(), db)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,10 @@ func TestRawStatementRows(t *testing.T) {
|
||||||
FROM dvds.actor
|
FROM dvds.actor
|
||||||
ORDER BY actor.actor_id`)
|
ORDER BY actor.actor_id`)
|
||||||
|
|
||||||
rows, err := stmt.Rows(context.Background(), db)
|
var rows *Rows
|
||||||
|
var err error
|
||||||
|
|
||||||
|
rows, err = stmt.Rows(context.Background(), db)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,10 @@ func TestRawStatementRows(t *testing.T) {
|
||||||
FROM actor
|
FROM actor
|
||||||
ORDER BY actor.actor_id`)
|
ORDER BY actor.actor_id`)
|
||||||
|
|
||||||
rows, err := stmt.Rows(context.Background(), db)
|
var rows *Rows
|
||||||
|
var err error
|
||||||
|
|
||||||
|
rows, err = stmt.Rows(context.Background(), db)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue