-
Notifications
You must be signed in to change notification settings - Fork 74
Refactor Vector implementation #686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 6.x
Are you sure you want to change the base?
Refactor Vector implementation #686
Conversation
| []byte | []any | map[string]any | | ||
| Node | Relationship | Path | ||
| Node | Relationship | Path | | ||
| Vector[int8] | Vector[int16] | Vector[int32] | Vector[int64] | Vector[float32] | Vector[float64] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: could expand GetRecordValue tests to cover new types.
| var _ Vector[float64] | ||
| var _ Vector[float32] | ||
| var _ Vector[int8] | ||
| var _ Vector[int16] | ||
| var _ Vector[int32] | ||
| var _ Vector[int64] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: might want to add dbtype aliases
| {"empty int64", Vector[int64]{}, "vector([], 0, INTEGER NOT NULL)"}, | ||
| {"empty float32", Vector[float32]{}, "vector([], 0, FLOAT32 NOT NULL)"}, | ||
| {"empty float64", Vector[float64]{}, "vector([], 0, FLOAT NOT NULL)"}, | ||
| {"empty int8", Vector[int8]{Elems: []int8{}}, "vector([], 0, INTEGER8 NOT NULL)"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While looking at this, I'm ever so slightly annoyed by having to read (and potentially having to write) the inner vector type twice...
I mean users can avoid this by writing a simple
func makeVec[T dbtype.VectorElement](elems []T) neo4j.Vector[T] {
return neo4j.Vector[T]{Elems: elems}
}
or similar... As a more seasoned Go dev, what's your gut feeling? Is it worth adding such a helper function to the driver or is it unnecessary noise?
Closes DRIVERS-115
Vectoris now a struct that holds a slice of elements.VectorElement.Vectortype variants toRecordValueandPropertyValueinterfaces, enabling extraction viaGetRecordValueandGetProperty.