mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-26 16:23:09 -06:00
- Update YAML file to use file: everywhere except for Accounts - Use the CosmosDB conn string in the YAML - Add cosmosdbapi package to wrap the external package - Add Tenant.go to store the tenancy settings - to be removed when tenancy is implemented - Update the 5 tables to use the internal CosmosDBAPI package instead of SQL - Remove sql from storage.go and other files
47 lines
1.1 KiB
Go
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,
|
|
}
|
|
}
|