-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Description
Query.newGqlQueryBuilder(type, gql).setBinding('testparam', null)
results in an exception because there is no way to set a null value.
Looking at the source code, I supposed a temporary workaround might be to bind to an empty List as there is a check in the binding code to set that to NullValue.
Currently, I am doing a workaround by putting null in the query String and using setAllowLiteral(true), but this is subOptimal as setAllowLiteral defaults to false.
What needs to be added is a setBinding that accepts NullValue, similar to how
StructuredQuery.PropertyFilter.eq allows
This is a simple addition as the MARSHALLER code for NullValue already exist. The implementation can be
public Builder<V> setNullBinding(String name) {
namedBindings.put(name, toBinding(NullValue.MARSHALLER, new ArrayList()));
return this;
}
toBinding checks for an empty list, and will bind NullValue
Metadata
Metadata
Assignees
Labels
api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.