Skip to content

Commit

Permalink
Add commented blank line to fix Driver deprecation notice (#506)
Browse files Browse the repository at this point in the history
* Add commented blank line to fix `Driver` deprecation notice

Fixes #502

* Fix other deprecation notices

* Fix deprecation wording of Severity

* Update neo4j/result.go

---------

Co-authored-by: Stephen Cathcart <stephen.cathcart@neotechnology.com>
  • Loading branch information
fbiville and StephenCathcart authored Jul 21, 2023
1 parent 72512ea commit 5f36183
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 13 deletions.
1 change: 1 addition & 0 deletions neo4j/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (

// Driver represents a pool(s) of connections to a neo4j server or cluster. It's
// safe for concurrent use.
//
// Deprecated: please use DriverWithContext instead. This interface will be removed in 6.0.
type Driver interface {
// Target returns the url this driver is bootstrapped
Expand Down
3 changes: 2 additions & 1 deletion neo4j/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ import (
"context"
)

// Result is created via the Session type.
//
// Deprecated: use ResultWithContext instead.
// ResultWithContext is created via the context-aware SessionWithContext type.
type Result interface {
// Keys returns the keys available on the result set.
Keys() ([]string, error)
Expand Down
4 changes: 2 additions & 2 deletions neo4j/resultsummary.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ type Notification interface {
// Not all notifications have a unique position to point to and in that case the position would be set to nil.
Position() InputPosition
// Severity returns the severity level of this notification.
// Deprecated: Severity will be removed in 6.0.
// Please rely on SeverityLevel (or RawSeverityLevel) instead.
//
// Deprecated: please use SeverityLevel (or RawSeverityLevel) instead. Severity will be removed in 6.0.
Severity() string
// RawSeverityLevel returns the unmapped severity level of this notification.
// This is useful when the driver cannot interpret the severity level returned by the server
Expand Down
8 changes: 5 additions & 3 deletions neo4j/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,22 @@ import (

// Session represents a logical connection (which is not tied to a physical connection)
// to the server
// Deprecated: use SessionWithContext instead.
//
// SessionWithContext is created via the context-aware driver returned
// by NewDriverWithContext.
// Session will be removed in 6.0.
//
// Deprecated: use SessionWithContext instead. Session will be removed in 6.0.
type Session interface {
// LastBookmarks returns the bookmark received following the last successfully completed transaction.
// If no bookmark was received or if this transaction was rolled back, the initial set of bookmarks will be
// returned.
LastBookmarks() Bookmarks
// LastBookmark returns the bookmark received following the last successfully completed transaction.
// If no bookmark was received or if this transaction was rolled back, the bookmark value will not be changed.
// Deprecated: since version 5.0. Will be removed in 6.0. Use LastBookmarks instead.
// Warning: this method can lead to unexpected behaviour if the session has not yet successfully completed a
// transaction.
//
// Deprecated: since version 5.0. Will be removed in 6.0. Use LastBookmarks instead.
LastBookmark() string
// BeginTransaction starts a new explicit transaction on this session
BeginTransaction(configurers ...func(*TransactionConfig)) (Transaction, error)
Expand Down
4 changes: 2 additions & 2 deletions neo4j/session_with_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ import (

// TransactionWork represents a unit of work that will be executed against the provided
// transaction
// Deprecated: use ManagedTransactionWork instead.
// ManagedTransactionWork is created via the context-aware driver returned
// by NewDriverWithContext.
// TransactionWork will be removed in 6.0.
//
// Deprecated: use ManagedTransactionWork instead. TransactionWork will be removed in 6.0.
type TransactionWork func(tx Transaction) (any, error)

// ManagedTransactionWork represents a unit of work that will be executed against the provided
Expand Down
4 changes: 2 additions & 2 deletions neo4j/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import (
)

// Transaction represents a transaction in the Neo4j database
// Deprecated: use ExplicitTransaction instead.
// ExplicitTransaction is available via SessionWithContext.
// SessionWithContext is available via the context-aware driver/returned
// by NewDriverWithContext.
// Transaction will be removed in 6.0.
//
// Deprecated: use ExplicitTransaction instead. Transaction will be removed in 6.0.
type Transaction interface {
// Run executes a statement on this transaction and returns a result
Run(cypher string, params map[string]any) (Result, error)
Expand Down
7 changes: 4 additions & 3 deletions testkit-backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -1244,9 +1244,10 @@ func serializeNotifications(slice []neo4j.Notification) []map[string]any {
var res []map[string]any
for i, notification := range slice {
res = append(res, map[string]any{
"code": notification.Code(),
"title": notification.Title(),
"description": notification.Description(),
"code": notification.Code(),
"title": notification.Title(),
"description": notification.Description(),
//lint:ignore SA1019 Severity is supported at least until 6.0
"severity": notification.Severity(),
"severityLevel": string(notification.SeverityLevel()),
"rawSeverityLevel": notification.RawSeverityLevel(),
Expand Down

0 comments on commit 5f36183

Please sign in to comment.