Files
dbx/count_test.go
T
end 689e022e3e 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>
2026-06-29 18:25:49 -07:00

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)
}