docs: Add CLAUDE.md with codebase guidance
Create comprehensive documentation for future Claude Code instances working in this repository, including: - Development commands for testing, building, and code quality - Core architecture overview of the SQL query builder system - Directory structure and component explanations - Testing patterns and conventions - Key dependencies and their purposes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package exec
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.fsdpf.net/go/db/exp"
|
||||
"github.com/DATA-DOG/go-sqlmock"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
@@ -67,3 +68,27 @@ func (s *scannerSuite) TestScanVals() {
|
||||
s.Require().NoError(err)
|
||||
s.Require().ElementsMatch([]int{1, 2}, result)
|
||||
}
|
||||
|
||||
func (s *scannerSuite) TestGetRecords() {
|
||||
db, mock, err := sqlmock.New()
|
||||
s.Require().NoError(err)
|
||||
|
||||
mock.ExpectQuery("SELECT \\* FROM `items`").
|
||||
WithArgs().
|
||||
WillReturnRows(
|
||||
sqlmock.NewRows([]string{"address", "name"}).
|
||||
AddRow("111 Test Addr", "Test1").
|
||||
AddRow("111 Test Addr", "Test1"),
|
||||
)
|
||||
|
||||
rows, err := db.Query("SELECT \\* FROM `items`")
|
||||
s.Require().NoError(err)
|
||||
|
||||
result, err := NewScanner(rows).GetRecords()
|
||||
s.Require().NoError(err)
|
||||
|
||||
s.Equal([]exp.Record{
|
||||
{"address": "111 Test Addr", "name": "Test1"},
|
||||
{"address": "111 Test Addr", "name": "Test1"},
|
||||
}, result)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user