Refactor for interface clarity and dependency isolation.
Some checks failed
Go / build-and-release (push) Has been cancelled

Replaced inline interface literals with dedicated, documented interface definitions in `pkg/interfaces/`. Introduced `TimeoutError`, `PolicyChecker`, and `Neo4jResultIterator` interfaces to clarify design, improve maintainability, and resolve potential circular dependencies. Updated config and constant usage rules for consistency. Incremented version to v0.31.11.
This commit is contained in:
2025-12-03 06:04:50 +00:00
parent 6c7d55ff7e
commit 69e2c873d8
11 changed files with 177 additions and 23 deletions

View File

@@ -5,12 +5,12 @@ import (
"fmt"
"strings"
"github.com/neo4j/neo4j-go-driver/v5/neo4j"
"next.orly.dev/pkg/database/indexes/types"
"git.mleku.dev/mleku/nostr/encoders/event"
"git.mleku.dev/mleku/nostr/encoders/filter"
"git.mleku.dev/mleku/nostr/encoders/hex"
"git.mleku.dev/mleku/nostr/encoders/tag"
"next.orly.dev/pkg/database/indexes/types"
"next.orly.dev/pkg/interfaces/resultiter"
"next.orly.dev/pkg/interfaces/store"
)
@@ -186,14 +186,10 @@ func (n *N) parseEventsFromResult(result any) ([]*event.E, error) {
events := make([]*event.E, 0)
ctx := context.Background()
// Type assert to the interface we actually use
resultIter, ok := result.(interface {
Next(context.Context) bool
Record() *neo4j.Record
Err() error
})
// Type assert to the result iterator interface
resultIter, ok := result.(resultiter.Neo4jResultIterator)
if !ok {
return nil, fmt.Errorf("invalid result type")
return nil, fmt.Errorf("invalid result type: expected resultiter.Neo4jResultIterator")
}
// Iterate through result records