Skip to content

Commit

Permalink
Change unexported return type to interfaces
Browse files Browse the repository at this point in the history
Fixes #378
  • Loading branch information
fbiville committed Jul 8, 2022
1 parent a3779e6 commit d3fa5a0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion neo4j/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type result struct {
}

// deprecated: use newResultWithContext instead
func newResult(conn db.Connection, str db.StreamHandle, cypher string, params map[string]interface{}) *result {
func newResult(conn db.Connection, str db.StreamHandle, cypher string, params map[string]interface{}) Result {
return newResultWithContext(conn, str, cypher, params).legacy()
}

Expand Down
7 changes: 4 additions & 3 deletions neo4j/result_with_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ type ResultWithContext interface {
Consume(ctx context.Context) (ResultSummary, error)
// IsOpen determines whether this result cursor is available
IsOpen() bool
legacy() *result
buffer(ctx context.Context)
legacy() Result
}

const consumedResultError = "result cursor is not available anymore"
Expand All @@ -72,7 +73,7 @@ type resultWithContext struct {
}

func newResultWithContext(conn idb.Connection, str idb.StreamHandle,
cypher string, params map[string]interface{}) *resultWithContext {
cypher string, params map[string]interface{}) ResultWithContext {
return &resultWithContext{
conn: conn,
streamHandle: str,
Expand Down Expand Up @@ -199,7 +200,7 @@ func (r *resultWithContext) IsOpen() bool {
return r.isOpen()
}

func (r *resultWithContext) legacy() *result {
func (r *resultWithContext) legacy() Result {
return &result{delegate: r}
}

Expand Down
2 changes: 1 addition & 1 deletion neo4j/transaction_with_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (tx *managedTransaction) legacy() Transaction {
// Does not implement the ExplicitTransaction nor the ManagedTransaction interface.
type autocommitTransaction struct {
conn db.Connection
res *resultWithContext
res ResultWithContext
closed bool
onClosed func()
}
Expand Down

0 comments on commit d3fa5a0

Please sign in to comment.