andreachild commented on code in PR #3285:
URL: https://github.com/apache/tinkerpop/pull/3285#discussion_r2624279533
##########
gremlin-go/driver/resultSet.go:
##########
@@ -211,3 +211,49 @@ func newChannelResultSetCapacity(requestID string,
container *synchronizedMap, c
func newChannelResultSet(requestID string, container *synchronizedMap)
ResultSet {
return newChannelResultSetCapacity(requestID, container,
defaultCapacity)
}
+
+// NewResultSet creates a new ResultSet from a slice of Result objects.
+// This function enables custom transport implementations to create ResultSets
from
+// results collected via alternative protocols.
+//
+// The function creates a channel-based ResultSet, pre-populates it with the
provided results,
+// and closes the channel to indicate completion.
+//
+// Parameters:
+// - requestID: The request identifier for this ResultSet
+// - results: A slice of Result objects to include in the ResultSet
+//
+// Returns:
+// - ResultSet: A ResultSet containing all the provided results
+//
+// Example usage:
+//
+// var results []*Result
+// // Collect results from custom transport
+// for _, responseBytes := range responses {
+// result, _ := DeserializeResult(responseBytes)
+// results = append(results, result)
+// }
+// resultSet := NewResultSet("request-123", results)
+// allResults, _ := resultSet.All()
+func NewResultSet(requestID string, results []*Result) ResultSet {
Review Comment:
I am curious why you opted to create a new constuctor instead of changing an
existing one to be public? Was there something lacking from the existing ones
which made them not usable for your use cases?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]