Skip to content
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

Query : Adds WithParameterStream to QueryDefinition to pass in serialized values #2222

Merged
merged 16 commits into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ internal CosmosSerializerCore(
this.customSerializer = null;
// this would allow us to set the JsonConverter and inturn handle Serialized/Stream Query Parameter Value.
this.sqlQuerySpecSerializer = CosmosSqlQuerySpecJsonConverter.CreateSqlQuerySpecSerializer(
cosmosSerializer: this.customSerializer,
cosmosSerializer: null,
kr-santosh marked this conversation as resolved.
Show resolved Hide resolved
propertiesSerializer: CosmosSerializerCore.propertiesSerializer);
this.patchOperationSerializer = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@ public async Task QueryStreamValueTest()
createdDateTime = createDateTime,
statusCode = HttpStatusCode.Accepted,
itemIds = new int[] { 1, 5, 10 },
itemcode = new byte?[5] { 0x16, (byte)'\0', 0x3, null, (byte)'}' },
};

dynamic testItem2 = new
Expand All @@ -878,6 +879,7 @@ public async Task QueryStreamValueTest()
createdDateTime = createDateTime,
statusCode = HttpStatusCode.Accepted,
itemIds = new int[] { 1, 5, 10 },
itemcode = new byte?[5] { 0x16, (byte)'\0', 0x3, null, (byte)'}' },
};

//with Custom Serializer.
Expand All @@ -899,7 +901,8 @@ public async Task QueryStreamValueTest()
|| itemType == typeof(string)
|| itemType == typeof(DateTime)
|| itemType == typeof(HttpStatusCode)
|| itemType == typeof(int[]))
|| itemType == typeof(int[])
|| itemType == typeof(byte))
{
toStreamCount++;
}
Expand Down Expand Up @@ -930,6 +933,8 @@ public async Task QueryStreamValueTest()
.WithParameterStream("@statusCode", cosmosSerializerHelper.ToStream<dynamic>(testItem1.statusCode)),
new QueryDefinition("select * from t where t.itemIds = @itemIds" )
.WithParameterStream("@itemIds", cosmosSerializerHelper.ToStream<dynamic>(testItem1.itemIds)),
new QueryDefinition("select * from t where t.itemcode = @itemcode" )
.WithParameterStream("@itemcode", cosmosSerializerHelper.ToStream<dynamic>(testItem1.itemcode)),
new QueryDefinition("select * from t where t.pk = @pk and t.cost = @cost" )
.WithParameterStream("@pk", cosmosSerializerHelper.ToStream<dynamic>(testItem1.pk))
.WithParameterStream("@cost", cosmosSerializerHelper.ToStream<dynamic>(testItem1.cost)),
Expand Down