fix type and nil panic errors
Some checks failed
Go / build-and-release (push) Has been cancelled

1. Added Err() method to CollectedResult (pkg/neo4j/neo4j.go:68-72):
    - The resultiter.Neo4jResultIterator interface requires Err() error
    - CollectedResult was missing this method, causing the type assertion to fail
    - Since CollectedResult pre-fetches all records, Err() always returns nil
  2. Fixed nil pointer dereference in buildCypherQuery (pkg/neo4j/query-events.go:173):
    - Changed if *f.Limit > 0 to if f.Limit != nil && *f.Limit > 0
    - This prevents a panic when filters don't specify a limit
  3. Simplified parseEventsFromResult signature (pkg/neo4j/query-events.go:185):
    - Changed from func (n *N) parseEventsFromResult(result any) to accept *CollectedResult directly
    - This eliminates the runtime type assertion since ExecuteRead already returns *CollectedResult
    - Removed the now-unused resultiter import
This commit is contained in:
2025-12-03 12:59:23 +00:00
parent de290aeb25
commit 1851ba39fa
3 changed files with 12 additions and 13 deletions

View File

@@ -65,6 +65,12 @@ func (r *CollectedResult) Len() int {
return len(r.records)
}
// Err returns any error from iteration (always nil for pre-collected results)
// This method satisfies the resultiter.Neo4jResultIterator interface
func (r *CollectedResult) Err() error {
return nil
}
// init registers the neo4j database factory
func init() {
database.RegisterNeo4jFactory(func(