feat(count): add QueryCount pagination helpers
Adds CountResult, QueryCount, BuildQueryCountFn, and ReadableTable alias for Jet pagination total counts, with tests and docs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user