Documentation
¶
Overview ¶
Package azcosmos implements the client to interact with the Azure Cosmos DB SQL API.
Index ¶
- type CompositeIndex
- type CompositeIndexOrder
- type ConflictResolutionMode
- type ConflictResolutionPolicy
- type ConsistencyLevel
- type CosmosClient
- func (c *CosmosClient) CreateDatabase(ctx context.Context, databaseProperties CosmosDatabaseProperties, ...) (CosmosDatabaseResponse, error)
- func (c *CosmosClient) GetCosmosContainer(databaseId string, containerId string) (*CosmosContainer, error)
- func (c *CosmosClient) GetCosmosDatabase(id string) (*CosmosDatabase, error)
- type CosmosClientOptions
- type CosmosClientOptionsRateLimitedRetry
- type CosmosContainer
- func (c *CosmosContainer) CreateItem(ctx context.Context, partitionKey *PartitionKey, item interface{}, ...) (CosmosItemResponse, error)
- func (c *CosmosContainer) Delete(ctx context.Context, requestOptions *CosmosContainerRequestOptions) (CosmosContainerResponse, error)
- func (c *CosmosContainer) DeleteItem(ctx context.Context, partitionKey *PartitionKey, itemId string, ...) (CosmosItemResponse, error)
- func (c *CosmosContainer) Read(ctx context.Context, requestOptions *CosmosContainerRequestOptions) (CosmosContainerResponse, error)
- func (c *CosmosContainer) ReadItem(ctx context.Context, partitionKey *PartitionKey, itemId string, ...) (CosmosItemResponse, error)
- func (c *CosmosContainer) ReadThroughput(ctx context.Context, requestOptions *ThroughputRequestOptions) (ThroughputResponse, error)
- func (c *CosmosContainer) Replace(ctx context.Context, containerProperties CosmosContainerProperties, ...) (CosmosContainerResponse, error)
- func (c *CosmosContainer) ReplaceItem(ctx context.Context, partitionKey *PartitionKey, itemId string, ...) (CosmosItemResponse, error)
- func (c *CosmosContainer) ReplaceThroughput(ctx context.Context, throughputProperties ThroughputProperties, ...) (ThroughputResponse, error)
- func (c *CosmosContainer) UpsertItem(ctx context.Context, partitionKey *PartitionKey, item interface{}, ...) (CosmosItemResponse, error)
- type CosmosContainerProperties
- type CosmosContainerRequestOptions
- type CosmosContainerResponse
- type CosmosDatabase
- func (db *CosmosDatabase) CreateContainer(ctx context.Context, containerProperties CosmosContainerProperties, ...) (CosmosContainerResponse, error)
- func (db *CosmosDatabase) Delete(ctx context.Context, requestOptions *CosmosDatabaseRequestOptions) (CosmosDatabaseResponse, error)
- func (db *CosmosDatabase) GetContainer(id string) (*CosmosContainer, error)
- func (db *CosmosDatabase) Read(ctx context.Context, requestOptions *CosmosDatabaseRequestOptions) (CosmosDatabaseResponse, error)
- func (db *CosmosDatabase) ReadThroughput(ctx context.Context, requestOptions *ThroughputRequestOptions) (ThroughputResponse, error)
- func (db *CosmosDatabase) ReplaceThroughput(ctx context.Context, throughputProperties ThroughputProperties, ...) (ThroughputResponse, error)
- type CosmosDatabaseProperties
- type CosmosDatabaseRequestOptions
- type CosmosDatabaseResponse
- type CosmosItemRequestOptions
- type CosmosItemResponse
- type DataType
- type ExcludedPath
- type IncludedPath
- type IndexingDirective
- type IndexingMode
- type IndexingPolicy
- type PartitionKey
- type PartitionKeyDefinition
- type PartitionKeyDefinitionVersion
- type SharedKeyCredential
- type SpatialIndex
- type SpatialType
- type ThroughputProperties
- type ThroughputRequestOptions
- type ThroughputResponse
- type UniqueKey
- type UniqueKeyPolicy
- type UnixTime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompositeIndex ¶
type CompositeIndex struct { // Path for the index. Path string `json:"path"` // Order represents the order of the composite index. // For example if you want to run the query "SELECT * FROM c ORDER BY c.age asc, c.height desc", // then you need to make the order for "/age" "ascending" and the order for "/height" "descending". Order CompositeIndexOrder `json:"order"` }
type CompositeIndexOrder ¶
type CompositeIndexOrder string
These are the ordering values available for composite indexes in the Azure Cosmos DB database service. For more information see https://docs.microsoft.com/azure/cosmos-db/index-policy
const ( // Ascending sort order for composite paths. CompositeIndexAscending CompositeIndexOrder = "ascending" // Descending sort order for composite paths. CompositeIndexDescending CompositeIndexOrder = "descending" )
func CompositeIndexOrderValues ¶
func CompositeIndexOrderValues() []CompositeIndexOrder
Returns a list of available consistency levels
func (CompositeIndexOrder) ToPtr ¶
func (c CompositeIndexOrder) ToPtr() *CompositeIndexOrder
type ConflictResolutionMode ¶
type ConflictResolutionMode string
ConflictResolutionMode defines the conflict resolution mode in the Azure Cosmos DB service.
const ( // Conflict resolution that uses the highest value of the conflicting documents property values. ConflictResolutionModeLastWriteWins ConflictResolutionMode = "LastWriterWins" // Custom conflict resolution mode that requires the definition of a stored procedure. ConflictResolutionModeCustom ConflictResolutionMode = "Custom" )
func ConflictResolutionModeValues ¶
func ConflictResolutionModeValues() []ConflictResolutionMode
Returns a list of available consistency levels
func (ConflictResolutionMode) ToPtr ¶
func (c ConflictResolutionMode) ToPtr() *ConflictResolutionMode
type ConflictResolutionPolicy ¶
type ConflictResolutionPolicy struct { // Conflict resolution mode. By default, the conflict resolution mode is LastWriteWins. Mode ConflictResolutionMode `json:"mode"` // The path which is present in each item in the container to be used on LastWriteWins conflict resolution. // It must be an integer value. ResolutionPath string `json:"conflictResolutionPath,omitempty"` // The stored procedure path on Custom conflict. // The path should be the full path to the procedure ResolutionProcedure string `json:"conflictResolutionProcedure,omitempty"` }
ConflictResolutionPolicy represents a conflict resolution policy for a container. For more information see https://docs.microsoft.com/azure/cosmos-db/unique-keys
type ConsistencyLevel ¶
type ConsistencyLevel string
Consistency levels supported by the Azure Cosmos DB service.
const ( ConsistencyLevelStrong ConsistencyLevel = "Strong" ConsistencyLevelBoundedStaleness ConsistencyLevel = "BoundedStaleness" ConsistencyLevelSession ConsistencyLevel = "Session" ConsistencyLevelEventual ConsistencyLevel = "Eventual" ConsistencyLevelConsistentPrefix ConsistencyLevel = "ConsistentPrefix" )
func ConsistencyLevelValues ¶
func ConsistencyLevelValues() []ConsistencyLevel
Returns a list of available consistency levels
func (ConsistencyLevel) ToPtr ¶
func (c ConsistencyLevel) ToPtr() *ConsistencyLevel
type CosmosClient ¶
type CosmosClient struct { // Endpoint used to create the client. Endpoint string // contains filtered or unexported fields }
A CosmosClient is used to interact with the Azure Cosmos DB database service.
func NewCosmosClient ¶
func NewCosmosClient(endpoint string, cred azcore.Credential, options *CosmosClientOptions) (*CosmosClient, error)
NewCosmosClient creates a new instance of CosmosClient with the specified values. It uses the default pipeline configuration. endpoint - The cosmos service endpoint to use. cred - The credential used to authenticate with the cosmos service. options - Optional CosmosClient options. Pass nil to accept default values.
func (*CosmosClient) CreateDatabase ¶
func (c *CosmosClient) CreateDatabase( ctx context.Context, databaseProperties CosmosDatabaseProperties, throughputProperties *ThroughputProperties, requestOptions *CosmosDatabaseRequestOptions) (CosmosDatabaseResponse, error)
CreateDatabase creates a new database. ctx - The context for the request. databaseProperties - The definition of the database throughputProperties - Optional throughput configuration of the database requestOptions - Optional parameters for the request.
func (*CosmosClient) GetCosmosContainer ¶
func (c *CosmosClient) GetCosmosContainer(databaseId string, containerId string) (*CosmosContainer, error)
GetCosmosContainer returns a CosmosContainer object. databaseId - The id of the database. containerId - The id of the container.
func (*CosmosClient) GetCosmosDatabase ¶
func (c *CosmosClient) GetCosmosDatabase(id string) (*CosmosDatabase, error)
GetCosmosDatabase returns a CosmosDatabase object. id - The id of the database.
type CosmosClientOptions ¶
type CosmosClientOptions struct { // HTTPClient sets the transport for making HTTP requests. HTTPClient azcore.Transport // Retry configures the built-in retry policy behavior. Retry azcore.RetryOptions // Telemetry configures the built-in telemetry policy behavior. Telemetry azcore.TelemetryOptions // Logging configures the built-in logging policy behavior. Logging azcore.LogOptions // PerCallPolicies contains custom policies to inject into the pipeline. // Each policy is executed once per request. PerCallPolicies []azcore.Policy // PerRetryPolicies contains custom policies to inject into the pipeline. // Each policy is executed once per request, and for each retry request. PerRetryPolicies []azcore.Policy // ApplicationPreferredRegions defines list of preferred regions for the client to connect to. ApplicationPreferredRegions *[]string // ConsistencyLevel can be used to weaken the database account consistency level for read operations. If this is not set the database account consistency level will be used for all requests. ConsistencyLevel ConsistencyLevel // When EnableContentResponseOnWrite is false will cause the response to have a null resource. This reduces networking and CPU load by not sending the resource back over the network and serializing it on the client. // The default is false. EnableContentResponseOnWrite bool // LimitToEndpoint limits the operations to the provided endpoint on the CosmosClient. See https://docs.microsoft.com/azure/cosmos-db/troubleshoot-sdk-availability LimitToEndpoint bool // RateLimitedRetry defines the retry configuration for rate limited requests. // By default, the SDK will do 9 retries. RateLimitedRetry *CosmosClientOptionsRateLimitedRetry }
CosmosClientOptions defines the options for the Cosmos client.
type CosmosContainer ¶
type CosmosContainer struct { // The Id of the Cosmos container Id string // The database that contains the container Database *CosmosDatabase // contains filtered or unexported fields }
A CosmosContainer lets you perform read, update, change throughput, and delete container operations. It also lets you perform read, update, change throughput, and delete item operations.
func (*CosmosContainer) CreateItem ¶
func (c *CosmosContainer) CreateItem( ctx context.Context, partitionKey *PartitionKey, item interface{}, requestOptions *CosmosItemRequestOptions) (CosmosItemResponse, error)
Creates an item in a Cosmos container. ctx - The context for the request. partitionKey - The partition key for the item. item - The item to create. requestOptions - Optional parameters for the request.
func (*CosmosContainer) Delete ¶
func (c *CosmosContainer) Delete( ctx context.Context, requestOptions *CosmosContainerRequestOptions) (CosmosContainerResponse, error)
Delete a Cosmos container. ctx - The context for the request. requestOptions - Optional parameters for the request.
func (*CosmosContainer) DeleteItem ¶
func (c *CosmosContainer) DeleteItem( ctx context.Context, partitionKey *PartitionKey, itemId string, requestOptions *CosmosItemRequestOptions) (CosmosItemResponse, error)
Deletes an item in a Cosmos container. ctx - The context for the request. partitionKey - The partition key for the item. itemId - The id of the item to delete. requestOptions - Optional parameters for the request.
func (*CosmosContainer) Read ¶
func (c *CosmosContainer) Read( ctx context.Context, requestOptions *CosmosContainerRequestOptions) (CosmosContainerResponse, error)
Read obtains the information for a Cosmos container. ctx - The context for the request. requestOptions - Optional parameters for the request.
func (*CosmosContainer) ReadItem ¶
func (c *CosmosContainer) ReadItem( ctx context.Context, partitionKey *PartitionKey, itemId string, requestOptions *CosmosItemRequestOptions) (CosmosItemResponse, error)
Reads an item in a Cosmos container. ctx - The context for the request. partitionKey - The partition key for the item. itemId - The id of the item to read. requestOptions - Optional parameters for the request.
func (*CosmosContainer) ReadThroughput ¶
func (c *CosmosContainer) ReadThroughput( ctx context.Context, requestOptions *ThroughputRequestOptions) (ThroughputResponse, error)
ReadThroughput obtains the provisioned throughput information for the container. ctx - The context for the request. requestOptions - Optional parameters for the request.
func (*CosmosContainer) Replace ¶
func (c *CosmosContainer) Replace( ctx context.Context, containerProperties CosmosContainerProperties, requestOptions *CosmosContainerRequestOptions) (CosmosContainerResponse, error)
Replace a Cosmos container. ctx - The context for the request. requestOptions - Optional parameters for the request.
func (*CosmosContainer) ReplaceItem ¶
func (c *CosmosContainer) ReplaceItem( ctx context.Context, partitionKey *PartitionKey, itemId string, item interface{}, requestOptions *CosmosItemRequestOptions) (CosmosItemResponse, error)
Replaces an item in a Cosmos container. ctx - The context for the request. partitionKey - The partition key of the item to replace. itemId - The id of the item to replace. item - The content to be used to replace. requestOptions - Optional parameters for the request.
func (*CosmosContainer) ReplaceThroughput ¶
func (c *CosmosContainer) ReplaceThroughput( ctx context.Context, throughputProperties ThroughputProperties, requestOptions *ThroughputRequestOptions) (ThroughputResponse, error)
ReplaceThroughput updates the provisioned throughput for the container. ctx - The context for the request. throughputProperties - The throughput configuration of the container. requestOptions - Optional parameters for the request.
func (*CosmosContainer) UpsertItem ¶
func (c *CosmosContainer) UpsertItem( ctx context.Context, partitionKey *PartitionKey, item interface{}, requestOptions *CosmosItemRequestOptions) (CosmosItemResponse, error)
Upserts (create or replace) an item in a Cosmos container. ctx - The context for the request. partitionKey - The partition key for the item. item - The item to upsert. requestOptions - Optional parameters for the request.
type CosmosContainerProperties ¶
type CosmosContainerProperties struct { // Id contains the unique id of the container. Id string `json:"id"` // ETag contains the entity etag of the container. ETag string `json:"_etag,omitempty"` // SelfLink contains the self-link of the container. SelfLink string `json:"_self,omitempty"` // ResourceId contains the resource id of the container. ResourceId string `json:"_rid,omitempty"` // LastModified contains the last modified time of the container. LastModified *UnixTime `json:"_ts,omitempty"` // DefaultTimeToLive contains the default time to live in seconds for items in the container. // For more information see https://docs.microsoft.com/azure/cosmos-db/time-to-live#time-to-live-configurations DefaultTimeToLive *int `json:"defaultTtl,omitempty"` // AnalyticalStoreTimeToLiveInSeconds contains the default time to live in seconds for analytical store in the container. // For more information see https://docs.microsoft.com/azure/cosmos-db/analytical-store-introduction#analytical-ttl AnalyticalStoreTimeToLiveInSeconds *int `json:"analyticalStorageTtl,omitempty"` // PartitionKeyDefinition contains the partition key definition of the container. PartitionKeyDefinition PartitionKeyDefinition `json:"partitionKey,omitempty"` // IndexingPolicy contains the indexing definition of the container. IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` // UniqueKeyPolicy contains the unique key policy of the container. UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` // ConflictResolutionPolicy contains the conflict resolution policy of the container. ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` // Container represented by these properties Container *CosmosContainer `json:"-"` }
CosmosContainerProperties represents the properties of a container.
type CosmosContainerRequestOptions ¶
type CosmosContainerRequestOptions struct {
PopulateQuotaInfo bool
}
CosmosContainerRequestOptions includes options for operations against a database.
type CosmosContainerResponse ¶
type CosmosContainerResponse struct { // ContainerProperties contains the unmarshalled response body in CosmosContainerProperties format. ContainerProperties *CosmosContainerProperties // contains filtered or unexported fields }
CosmosContainerResponse represents the response from a container request.
func (*CosmosContainerResponse) ActivityId ¶
func (c *CosmosContainerResponse) ActivityId() string
ActivityId contains the value from the activity header.
func (*CosmosContainerResponse) ETag ¶
func (c *CosmosContainerResponse) ETag() string
ETag contains the value from the ETag header.
func (*CosmosContainerResponse) RequestCharge ¶
func (c *CosmosContainerResponse) RequestCharge() float32
RequestCharge contains the value from the request charge header.
func (*CosmosContainerResponse) SessionToken ¶
func (c *CosmosContainerResponse) SessionToken() string
SessionToken contains the value from the session token header to be used on session consistency.
type CosmosDatabase ¶
type CosmosDatabase struct { // The Id of the Cosmos database Id string // contains filtered or unexported fields }
A CosmosDatabase lets you perform read, update, change throughput, and delete database operations.
func (*CosmosDatabase) CreateContainer ¶
func (db *CosmosDatabase) CreateContainer( ctx context.Context, containerProperties CosmosContainerProperties, throughputProperties *ThroughputProperties, requestOptions *CosmosContainerRequestOptions) (CosmosContainerResponse, error)
CreateContainer creates a container in the Cosmos database. ctx - The context for the request. containerProperties - The properties for the container. throughputProperties - Optional throughput configuration of the container requestOptions - Optional parameters for the request.
func (*CosmosDatabase) Delete ¶
func (db *CosmosDatabase) Delete( ctx context.Context, requestOptions *CosmosDatabaseRequestOptions) (CosmosDatabaseResponse, error)
Delete a Cosmos database. ctx - The context for the request. requestOptions - Optional parameters for the request.
func (*CosmosDatabase) GetContainer ¶
func (db *CosmosDatabase) GetContainer(id string) (*CosmosContainer, error)
GetContainer returns a CosmosContainer object for the container. id - The id of the container.
func (*CosmosDatabase) Read ¶
func (db *CosmosDatabase) Read( ctx context.Context, requestOptions *CosmosDatabaseRequestOptions) (CosmosDatabaseResponse, error)
Read obtains the information for a Cosmos database. ctx - The context for the request. requestOptions - Optional parameters for the request.
func (*CosmosDatabase) ReadThroughput ¶
func (db *CosmosDatabase) ReadThroughput( ctx context.Context, requestOptions *ThroughputRequestOptions) (ThroughputResponse, error)
ReadThroughput obtains the provisioned throughput information for the database. ctx - The context for the request. requestOptions - Optional parameters for the request.
func (*CosmosDatabase) ReplaceThroughput ¶
func (db *CosmosDatabase) ReplaceThroughput( ctx context.Context, throughputProperties ThroughputProperties, requestOptions *ThroughputRequestOptions) (ThroughputResponse, error)
ReplaceThroughput updates the provisioned throughput for the database. ctx - The context for the request. throughputProperties - The throughput configuration of the database. requestOptions - Optional parameters for the request.
type CosmosDatabaseProperties ¶
type CosmosDatabaseProperties struct { // Id contains the unique id of the database. Id string `json:"id"` // ETag contains the entity etag of the database ETag string `json:"_etag,omitempty"` // SelfLink contains the self-link of the database SelfLink string `json:"_self,omitempty"` // ResourceId contains the resource id of the database ResourceId string `json:"_rid,omitempty"` // LastModified contains the last modified time of the database LastModified *UnixTime `json:"_ts,omitempty"` // Database represented by these properties Database *CosmosDatabase `json:"-"` }
CosmosDatabaseProperties represents the properties of a database.
type CosmosDatabaseRequestOptions ¶
CosmosDatabaseRequestOptions includes options for operations against a database.
type CosmosDatabaseResponse ¶
type CosmosDatabaseResponse struct { // DatabaseProperties contains the unmarshalled response body in CosmosDatabaseProperties format. DatabaseProperties *CosmosDatabaseProperties // contains filtered or unexported fields }
CosmosDatabaseResponse represents the response from a database request.
func (*CosmosDatabaseResponse) ActivityId ¶
func (c *CosmosDatabaseResponse) ActivityId() string
ActivityId contains the value from the activity header.
func (*CosmosDatabaseResponse) ETag ¶
func (c *CosmosDatabaseResponse) ETag() string
ETag contains the value from the ETag header.
func (*CosmosDatabaseResponse) RequestCharge ¶
func (c *CosmosDatabaseResponse) RequestCharge() float32
RequestCharge contains the value from the request charge header.
func (*CosmosDatabaseResponse) SessionToken ¶
func (c *CosmosDatabaseResponse) SessionToken() string
SessionToken contains the value from the session token header to be used on session consistency.
type CosmosItemRequestOptions ¶
type CosmosItemRequestOptions struct { // Triggers to be invoked before the operation. PreTriggers []string // Triggers to be invoked after the operation. PostTriggers []string // SessionToken to be used when using Session consistency on the account. // When working with Session consistency, each new write request to Azure Cosmos DB is assigned a new SessionToken. // The client instance will use this token internally with each read/query request to ensure that the set consistency level is maintained. // In some scenarios you need to manage this Session yourself: Consider a web application with multiple nodes, each node will have its own client instance. // If you wanted these nodes to participate in the same session (to be able read your own writes consistently across web tiers), // you would have to send the SessionToken from the response of the write action on one node to the client tier, using a cookie or some other mechanism, and have that token flow back to the web tier for subsequent reads. // If you are using a round-robin load balancer which does not maintain session affinity between requests, such as the Azure Load Balancer,the read could potentially land on a different node to the write request, where the session was created. SessionToken string // ConsistencyLevel overrides the account defined consistency level for this operation. // Consistency can only be relaxed. ConsistencyLevel *ConsistencyLevel // Indexing directive to be applied to the operation. IndexingDirective *IndexingDirective // When EnableContentResponseOnWrite is false will cause the response on write operations to have a null resource. This reduces networking and CPU load by not sending the resource back over the network and serializing it on the client. // The default is false. EnableContentResponseOnWrite bool }
CosmosItemRequestOptions includes options for operations on items.
type CosmosItemResponse ¶
type CosmosItemResponse struct { // The byte content of the operation response. Value []byte // contains filtered or unexported fields }
CosmosItemResponse represents the response from an item request.
func (*CosmosItemResponse) ActivityId ¶
func (c *CosmosItemResponse) ActivityId() string
ActivityId contains the value from the activity header.
func (*CosmosItemResponse) ETag ¶
func (c *CosmosItemResponse) ETag() string
ETag contains the value from the ETag header.
func (*CosmosItemResponse) RequestCharge ¶
func (c *CosmosItemResponse) RequestCharge() float32
RequestCharge contains the value from the request charge header.
func (*CosmosItemResponse) SessionToken ¶
func (c *CosmosItemResponse) SessionToken() string
SessionToken contains the value from the session token header to be used on session consistency.
type DataType ¶
type DataType string
DataType defines supported values for data types in Spatial Indexes
const ( // Represents a line. DataTypeString DataType = "String" // Represents a number. DataTypeNumber DataType = "Number" // Represents a point. DataTypePoint DataType = "Point" // Represents a polygon. DataTypePolygon DataType = "Polygon" // Represents a line string. DataTypeLineString DataType = "LineString" // Represents a multi polygon. DataTypeMultiPolygon DataType = "MultiPolygon" )
type ExcludedPath ¶
type ExcludedPath struct { // Path to be excluded. Path string `json:"path"` }
ExcludedPath represents a json path to be excluded from indexing.
type IncludedPath ¶
type IncludedPath struct { // Path to be included. Path string `json:"path"` }
IncludedPath represents a json path to be included in indexing.
type IndexingDirective ¶
type IndexingDirective string
Specifies whether or not the resource in the Azure Cosmos DB database is to be indexed.
const ( // Use any pre-defined/pre-configured defaults. IndexingDirectiveDefault IndexingDirective = "Default" // Index the resource. IndexingDirectiveInclude IndexingDirective = "Include" // Do not index the resource. IndexingDirectiveExclude IndexingDirective = "Exclude" )
func IndexingDirectives ¶
func IndexingDirectives() []IndexingDirective
Returns a list of available indexing directives
func (IndexingDirective) ToPtr ¶
func (c IndexingDirective) ToPtr() *IndexingDirective
type IndexingMode ¶
type IndexingMode string
IndexingMode defines the supported indexing modes in the Azure Cosmos DB service.
const ( // IndexingModeConsistent Index is updated synchronously with a create, update or delete operation. IndexingModeConsistent IndexingMode = "Consistent" // No index is provided. IndexingModeNone IndexingMode = "None" )
func IndexingModeValues ¶
func IndexingModeValues() []IndexingMode
Returns a list of available consistency levels
func (IndexingMode) ToPtr ¶
func (c IndexingMode) ToPtr() *IndexingMode
type IndexingPolicy ¶
type IndexingPolicy struct { // Automatic defines if the indexing policy is automatic or manual. Automatic bool `json:"automatic"` // IndexingMode for the container. IndexingMode IndexingMode `json:"indexingMode,omitempty"` // Paths to be indexed. IncludedPaths []IncludedPath `json:"includedPaths,omitempty"` // Paths to be excluded. ExcludedPaths []ExcludedPath `json:"excludedPaths,omitempty"` // Spatial indexes. SpatialIndexes []SpatialIndex `json:"spatialIndexes,omitempty"` // Spatial indexes. CompositeIndexes [][]CompositeIndex `json:"compositeIndexes,omitempty"` }
IndexingPolicy represents an indexing policy for a container. For more information see https://docs.microsoft.com/azure/cosmos-db/index-policy
type PartitionKey ¶
type PartitionKey struct {
// contains filtered or unexported fields
}
PartitionKey represents a logical partition key value.
func NewPartitionKey ¶
func NewPartitionKey(value interface{}) (*PartitionKey, error)
NewPartitionKey creates a new partition key. value - the partition key value.
func NewPartitionKeyNone ¶
func NewPartitionKeyNone() *PartitionKey
NewPartitionKeyNone creates a partition key value for non-partitioned containers.
type PartitionKeyDefinition ¶
type PartitionKeyDefinition struct { // Paths returns the list of partition key paths of the container. Paths []string `json:"paths"` // Version returns the version of the hash partitioning of the container. Version PartitionKeyDefinitionVersion `json:"version,omitempty"` }
PartitionKeyDefinition represents a partition key definition in the Azure Cosmos DB database service. A partition key definition defines the path for the partition key property.
type PartitionKeyDefinitionVersion ¶
type PartitionKeyDefinitionVersion int
Version of the hash partitioning
const ( // Original version of hash partitioning. PartitionKeyDefinitionVersion1 PartitionKeyDefinitionVersion = 1 // Enhanced version of hash partitioning - offers better distribution of long partition keys and uses less storage. PartitionKeyDefinitionVersion2 PartitionKeyDefinitionVersion = 2 )
func PartitionKeyDefinitionVersionValues ¶
func PartitionKeyDefinitionVersionValues() []PartitionKeyDefinitionVersion
Returns a list of available consistency levels
func (PartitionKeyDefinitionVersion) ToPtr ¶
func (c PartitionKeyDefinitionVersion) ToPtr() *PartitionKeyDefinitionVersion
type SharedKeyCredential ¶
type SharedKeyCredential struct {
// contains filtered or unexported fields
}
SharedKeyCredential contains an account's name and its primary or secondary key. It is immutable making it shareable and goroutine-safe.
func NewSharedKeyCredential ¶
func NewSharedKeyCredential(accountKey string) (*SharedKeyCredential, error)
NewSharedKeyCredential creates an immutable SharedKeyCredential containing the account's primary or secondary key.
func (*SharedKeyCredential) AuthenticationPolicy ¶
func (c *SharedKeyCredential) AuthenticationPolicy(azcore.AuthenticationPolicyOptions) azcore.Policy
AuthenticationPolicy implements the Credential interface on SharedKeyCredential.
func (*SharedKeyCredential) SetAccountKey ¶
func (c *SharedKeyCredential) SetAccountKey(accountKey string) error
SetAccountKey replaces the existing account key with the specified account key.
type SpatialIndex ¶
type SpatialIndex struct { // Path for the index. Path string `json:"path"` // SpatialType of the spatial index. SpatialTypes []SpatialType `json:"types"` }
SpatialIndex represents a spatial index.
type SpatialType ¶
type SpatialType string
SpatialType defines supported values for spatial index types in Spatial Indexes
const ( // Represents a point. SpatialTypePoint SpatialType = "Point" // Represents a polygon. SpatialTypePolygon SpatialType = "Polygon" // Represents a line string. SpatialTypeLineString SpatialType = "LineString" // Represents a multi polygon. SpatialTypeMultiPolygon SpatialType = "MultiPolygon" )
func SpatialTypeValues ¶
func SpatialTypeValues() []SpatialType
Returns a list of available data types
func (SpatialType) ToPtr ¶
func (c SpatialType) ToPtr() *SpatialType
type ThroughputProperties ¶
type ThroughputProperties struct { ETag string LastModified *UnixTime // contains filtered or unexported fields }
ThroughputProperties describes the throughput configuration of a resource.
func NewAutoscaleThroughputProperties ¶
func NewAutoscaleThroughputProperties(startingMaxThroughput int) *ThroughputProperties
NewAutoscaleThroughputProperties returns a ThroughputProperties object with the given max throughput on autoscale mode. maxThroughput - the max throughput in RU/s
func NewAutoscaleThroughputPropertiesWithIncrement ¶
func NewAutoscaleThroughputPropertiesWithIncrement(startingMaxThroughput int, incrementPercentage int) *ThroughputProperties
NewAutoscaleThroughputPropertiesWithIncrement returns a ThroughputProperties object with the given max throughput on autoscale mode. maxThroughput - the max throughput in RU/s incrementPercentage - the auto upgrade max throughput increment percentage
func NewManualThroughputProperties ¶
func NewManualThroughputProperties(throughput int) *ThroughputProperties
NewManualThroughputProperties returns a ThroughputProperties object with the given throughput in manual mode. throughput - the throughput in RU/s
func (*ThroughputProperties) AutoscaleMaxThroughput ¶
func (tp *ThroughputProperties) AutoscaleMaxThroughput() (int, error)
AutoscaleMaxThroughput returns the configured max throughput on autoscale mode.
func (*ThroughputProperties) ManualThroughput ¶
func (tp *ThroughputProperties) ManualThroughput() (int, error)
ManualThroughput returns the provisioned throughput in manual mode.
func (*ThroughputProperties) MarshalJSON ¶
func (tp *ThroughputProperties) MarshalJSON() ([]byte, error)
func (*ThroughputProperties) UnmarshalJSON ¶
func (tp *ThroughputProperties) UnmarshalJSON(b []byte) error
type ThroughputRequestOptions ¶
ThroughputRequestOptions includes options for throughput operations.
type ThroughputResponse ¶
type ThroughputResponse struct { // ThroughputProperties contains the unmarshalled response body in ThroughputProperties format. ThroughputProperties *ThroughputProperties // contains filtered or unexported fields }
ThroughputResponse represents the response from a throughput request.
func (*ThroughputResponse) ActivityId ¶
func (c *ThroughputResponse) ActivityId() string
ActivityId contains the value from the activity header.
func (*ThroughputResponse) ETag ¶
func (c *ThroughputResponse) ETag() string
ETag contains the value from the ETag header.
func (*ThroughputResponse) IsReplacePending ¶
func (r *ThroughputResponse) IsReplacePending() *bool
IsReplacePending returns the state of a throughput update.
func (*ThroughputResponse) MinThroughput ¶
func (r *ThroughputResponse) MinThroughput() *int
MinThroughput is minimum throughput in measurement of request units per second in the Azure Cosmos service.
func (*ThroughputResponse) RequestCharge ¶
func (c *ThroughputResponse) RequestCharge() float32
RequestCharge contains the value from the request charge header.
func (*ThroughputResponse) SessionToken ¶
func (c *ThroughputResponse) SessionToken() string
SessionToken contains the value from the session token header to be used on session consistency.
type UniqueKey ¶
type UniqueKey struct { // Paths define a sets of paths which must be unique for each document. Paths []string `json:"paths"` }
UniqueKey represents a unique key for a container. For more information see https://docs.microsoft.com/azure/cosmos-db/unique-keys
type UniqueKeyPolicy ¶
type UniqueKeyPolicy struct { // Automatic defines if the indexing policy is automatic or manual. UniqueKeys []UniqueKey `json:"uniqueKeys"` }
UniqueKeyPolicy represents a unique key policy for a container. For more information see https://docs.microsoft.com/azure/cosmos-db/unique-keys
Source Files
¶
- async_cache.go
- composite_index_order.go
- conflict_resolution_mode.go
- conflict_resolution_policy.go
- consistency_level.go
- cosmos_client.go
- cosmos_client_connection.go
- cosmos_client_options.go
- cosmos_container.go
- cosmos_container_properties.go
- cosmos_container_request_options.go
- cosmos_container_response.go
- cosmos_database.go
- cosmos_database_properties.go
- cosmos_database_request_options.go
- cosmos_database_response.go
- cosmos_error.go
- cosmos_headers.go
- cosmos_item_request_options.go
- cosmos_item_response.go
- cosmos_offers.go
- cosmos_operation_context.go
- cosmos_paths.go
- cosmos_request_options.go
- cosmos_response.go
- data_type.go
- doc.go
- indexing_directive.go
- indexing_mode.go
- indexing_policy.go
- partition_key.go
- partition_key_definition.go
- partition_key_definition_version.go
- partition_key_internal.go
- resource_throttle_retry_policy.go
- resource_type.go
- shared_key_credential.go
- spatial_type.go
- throughput_properties.go
- throughput_request_options.go
- throughput_response.go
- unique_key_policy.go
- unixtime.go