689e022e3e
Adds CountResult, QueryCount, BuildQueryCountFn, and ReadableTable alias for Jet pagination total counts, with tests and docs. Co-authored-by: Cursor <cursoragent@cursor.com>
25 lines
454 B
Go
25 lines
454 B
Go
package dbx
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestCountResult_Scan(t *testing.T) {
|
|
stmt := mockStatement{
|
|
queryContextFn: func(_ context.Context, dest any) error {
|
|
ptr := dest.(*CountResult)
|
|
ptr.Count = 3
|
|
return nil
|
|
},
|
|
}
|
|
|
|
var scanned CountResult
|
|
err := stmt.Query(mockQueryable{}, &scanned)
|
|
require.NoError(t, err)
|
|
assert.Equal(t, 3, scanned.Count)
|
|
}
|