dendrite/internal/cosmosdbapi/documentoperations.go
alexfca 60e11f88b8
- Remove PerformQueryAllPartitions as it does not support aggreates (#24)
- Update queries to all use PartitionKeys
- Remove the _sid from queries as the PK contains the Tenant
- Fix some bugs around empty values and ordering

Co-authored-by: alexf@example.com <alexf@example.com>
2021-10-08 11:17:22 +11:00

47 lines
1.1 KiB
Go

package cosmosdbapi
import (
cosmosapi "github.com/vippsas/go-cosmosdb/cosmosapi"
)
func GetCreateDocumentOptions(pk string) cosmosapi.CreateDocumentOptions {
return cosmosapi.CreateDocumentOptions{
IsUpsert: false,
PartitionKeyValue: pk,
}
}
func getUpsertDocumentOptions(pk string) cosmosapi.CreateDocumentOptions {
return cosmosapi.CreateDocumentOptions{
IsUpsert: true,
PartitionKeyValue: pk,
}
}
func getQueryDocumentsOptions(pk string) cosmosapi.QueryDocumentsOptions {
return cosmosapi.QueryDocumentsOptions{
PartitionKeyValue: pk,
IsQuery: true,
ContentType: cosmosapi.QUERY_CONTENT_TYPE,
}
}
func GetGetDocumentOptions(pk string) cosmosapi.GetDocumentOptions {
return cosmosapi.GetDocumentOptions{
PartitionKeyValue: pk,
}
}
func getReplaceDocumentOptions(pk string, etag string) cosmosapi.ReplaceDocumentOptions {
return cosmosapi.ReplaceDocumentOptions{
PartitionKeyValue: pk,
IfMatch: etag,
}
}
func GetDeleteDocumentOptions(pk string) cosmosapi.DeleteDocumentOptions {
return cosmosapi.DeleteDocumentOptions{
PartitionKeyValue: pk,
}
}