aztable

package module
v0.0.0-...-658d8c5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2021 License: MIT Imports: 29 Imported by: 1

README

Azure Tables client library for Go

Azure Table storage is a service that stores large amounts of structured NoSQL data in the cloud, providing a key/attribute store with a schema-less design.

Azure Cosmos DB provides a Table API for applications that are written for Azure Table storage that need premium capabilities like:

  • Turnkey global distribution.
  • Dedicated throughput worldwide.
  • Single-digit millisecond latencies at the 99th percentile.
  • Guaranteed high availability.
  • Automatic secondary indexing.

The Azure Tables client library can seamlessly target either Azure Table storage or Azure Cosmos DB table service endpoints with no code changes.

Getting started

Install the package

Install the Azure Tables client library for Go :

Prerequisites
  • An Azure subscription.
  • An existing Azure storage account or Azure Cosmos DB database with Azure Table API specified.

If you need to create either of these, you can use the Azure CLI.

Creating a storage account

Create a storage account mystorageaccount in resource group MyResourceGroup in the subscription MySubscription in the West US region.

Creating a Cosmos DB

Create a Cosmos DB account MyCosmosDBDatabaseAccount in resource group MyResourceGroup in the subscription MySubscription and a table named MyTableName in the account.

Authenticate the Client

Learn more about options for authentication (including Connection Strings, Shared Key, and Shared Key Signatures) in our samples.

Key concepts

  • TableServiceClient - Client that provides methods to interact at the Table Service level such as creating, listing, and deleting tables
  • TableClient - Client that provides methods to interact at an table entity level such as creating, querying, and deleting entities within a table.
  • Table - Tables store data as collections of entities.
  • Entity - Entities are similar to rows. An entity has a primary key and a set of properties. A property is a name value pair, similar to a column.

Common uses of the Table service include:

  • Storing TBs of structured data capable of serving web scale applications
  • Storing datasets that don't require complex joins, foreign keys, or stored procedures and can be de-normalized for fast access
  • Quickly querying data using a clustered index
Create the Table service client

First, we need to construct a TableServiceClient.

Create an Azure table

Next, we can create a new table.

Get an Azure table

The set of existing Azure tables can be queries using an OData filter.

Delete an Azure table

Individual tables can be deleted from the service.

Create the Table client

To interact with table entities, we must first construct a TableClient.

Add table entities

Let's define a new TableEntity so that we can add it to the table.

Using the TableClient we can now add our new entity to the table.

Query table entities

To inspect the set of existing table entities, we can query the table using an OData filter.

If you prefer LINQ style query expressions, we can query the table using that syntax as well.

Delete table entities

If we no longer need our new table entity, it can be deleted.

Troubleshooting

When you interact with the Azure table library using the .NET SDK, errors returned by the service correspond to the same HTTP status codes returned for REST API requests.

For example, if you try to create a table that already exists, a 409 error is returned, indicating "Conflict".

Setting up console logging

The simplest way to see the logs is to enable the console logging. To create an Azure SDK log listener that outputs messages to console use AzureEventSourceListener.CreateConsoleLogger method.

To learn more about other logging mechanisms see here.

Next steps

Get started with our Table samples.

Known Issues

A list of currently known issues relating to Cosmos DB table endpoints can be found here.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit cla.microsoft.com.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Generating the client

From the tables dir:

autorest --use=@autorest/go@4.0.0-preview.20 https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/data-plane/readme.md --tag=package-2019-02 --file-prefix="zz_generated_" --modelerfour.lenient-model-deduplication --license-header=MICROSOFT_MIT_NO_VERSION --output-folder=aztable --module=aztable --openapi-type="data-plane" --credential-scope=none

Impressions

Documentation

Index

Constants

View Source
const (
	LegacyCosmosTableDomain = ".table.cosmosdb."
	CosmosTableDomain       = ".table.cosmos."
)
View Source
const (
	OdataType = "@odata.type"

	ISO8601 = "2006-01-02T15:04:05.9999999Z"
)

nolint

View Source
const (
	DefaultStorageSuffix = "core.windows.net"
	DefaultCosmosSuffix  = "cosmos.azure.com"
)

Variables

This section is empty.

Functions

func EntityMapAsModel

func EntityMapAsModel(entityMap map[string]interface{}, model interface{}) error

EntityMapAsModel converts a table entity in the form of map[string]interface{} and converts it to a strongly typed model.

Example: mapEntity, err := client.GetEntity("somePartition", "someRow") myEntityModel := MyModel{} err = EntityMapAsModel(mapEntity, &myEntityModel)

Types

type AccessPolicy

type AccessPolicy struct {
	// REQUIRED; The datetime that the policy expires.
	Expiry *time.Time `xml:"Expiry"`

	// REQUIRED; The permissions for the acl policy.
	Permission *string `xml:"Permission"`

	// REQUIRED; The start datetime from which the policy is active.
	Start *time.Time `xml:"Start"`
}

AccessPolicy - An Access policy.

func (AccessPolicy) MarshalXML

func (a AccessPolicy) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaller interface for type AccessPolicy.

func (*AccessPolicy) UnmarshalXML

func (a *AccessPolicy) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements the xml.Unmarshaller interface for type AccessPolicy.

type CorsRule

type CorsRule struct {
	// REQUIRED; The request headers that the origin domain may specify on the CORS request.
	AllowedHeaders *string `xml:"AllowedHeaders"`

	// REQUIRED; The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated)
	AllowedMethods *string `xml:"AllowedMethods"`

	// REQUIRED; The origin domains that are permitted to make a request against the service via CORS. The origin domain is the domain from which the request
	// originates. Note that the origin must be an exact
	// case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains
	// to make requests via CORS.
	AllowedOrigins *string `xml:"AllowedOrigins"`

	// REQUIRED; The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer.
	ExposedHeaders *string `xml:"ExposedHeaders"`

	// REQUIRED; The maximum amount time that a browser should cache the preflight OPTIONS request.
	MaxAgeInSeconds *int32 `xml:"MaxAgeInSeconds"`
}

CorsRule - CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain.

type CosmosPatchTransformPolicy

type CosmosPatchTransformPolicy struct{}

CosmosPatchTransformPolicy transforms PATCH requests into POST requests with the "X-HTTP-Method":"MERGE" header set.

func (CosmosPatchTransformPolicy) Do

type EndpointType

type EndpointType string
const (
	StorageEndpoint EndpointType = "storage"
	CosmosEndpoint  EndpointType = "cosmos"
)

type GeoReplication

type GeoReplication struct {
	// REQUIRED; A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available for read operations at the secondary.
	// Primary writes after this point in time may or may
	// not be available for reads.
	LastSyncTime *time.Time `xml:"LastSyncTime"`

	// REQUIRED; The status of the secondary location.
	Status *GeoReplicationStatusType `xml:"Status"`
}

func (GeoReplication) MarshalXML

func (g GeoReplication) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaller interface for type GeoReplication.

func (*GeoReplication) UnmarshalXML

func (g *GeoReplication) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements the xml.Unmarshaller interface for type GeoReplication.

type GeoReplicationStatusType

type GeoReplicationStatusType string

GeoReplicationStatusType - The status of the secondary location.

const (
	GeoReplicationStatusTypeBootstrap   GeoReplicationStatusType = "bootstrap"
	GeoReplicationStatusTypeLive        GeoReplicationStatusType = "live"
	GeoReplicationStatusTypeUnavailable GeoReplicationStatusType = "unavailable"
)

func PossibleGeoReplicationStatusTypeValues

func PossibleGeoReplicationStatusTypeValues() []GeoReplicationStatusType

PossibleGeoReplicationStatusTypeValues returns the possible values for the GeoReplicationStatusType const type.

func (GeoReplicationStatusType) ToPtr

ToPtr returns a *GeoReplicationStatusType pointing to the current value.

type Logging

type Logging struct {
	// REQUIRED; Indicates whether all delete requests should be logged.
	Delete *bool `xml:"Delete"`

	// REQUIRED; Indicates whether all read requests should be logged.
	Read *bool `xml:"Read"`

	// REQUIRED; The retention policy.
	RetentionPolicy *RetentionPolicy `xml:"RetentionPolicy"`

	// REQUIRED; The version of Analytics to configure.
	Version *string `xml:"Version"`

	// REQUIRED; Indicates whether all write requests should be logged.
	Write *bool `xml:"Write"`
}

Logging - Azure Analytics Logging settings.

type MapOfInterfaceResponse

type MapOfInterfaceResponse struct {
	// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
	ClientRequestID *string

	// ContentType contains the information returned from the Content-Type header response.
	ContentType *string

	// Date contains the information returned from the Date header response.
	Date *time.Time

	// ETag contains the information returned from the ETag header response.
	ETag *string

	// PreferenceApplied contains the information returned from the Preference-Applied header response.
	PreferenceApplied *string

	// RawResponse contains the underlying HTTP response.
	RawResponse *http.Response

	// RequestID contains the information returned from the x-ms-request-id header response.
	RequestID *string

	// The other properties of the table entity.
	Value map[string]interface{}

	// Version contains the information returned from the x-ms-version header response.
	Version *string

	// XMSContinuationNextPartitionKey contains the information returned from the x-ms-continuation-NextPartitionKey header response.
	XMSContinuationNextPartitionKey *string

	// XMSContinuationNextRowKey contains the information returned from the x-ms-continuation-NextRowKey header response.
	XMSContinuationNextRowKey *string
}

MapOfInterfaceResponse is the response envelope for operations that return a map[string]interface{} type.

type Metrics

type Metrics struct {
	// REQUIRED; Indicates whether metrics are enabled for the Table service.
	Enabled *bool `xml:"Enabled"`

	// Indicates whether metrics should generate summary statistics for called API operations.
	IncludeAPIs *bool `xml:"IncludeAPIs"`

	// The retention policy.
	RetentionPolicy *RetentionPolicy `xml:"RetentionPolicy"`

	// The version of Analytics to configure.
	Version *string `xml:"Version"`
}

type OdataError

type OdataError struct {
	Code    string            `json:"code"`
	Message OdataErrorMessage `json:"message"`
}

type OdataErrorMessage

type OdataErrorMessage struct {
	Lang  string `json:"lang"`
	Value string `json:"value"`
}

type OdataMetadataFormat

type OdataMetadataFormat string
const (
	OdataMetadataFormatApplicationJSONOdataFullmetadata    OdataMetadataFormat = "application/json;odata=fullmetadata"
	OdataMetadataFormatApplicationJSONOdataMinimalmetadata OdataMetadataFormat = "application/json;odata=minimalmetadata"
	OdataMetadataFormatApplicationJSONOdataNometadata      OdataMetadataFormat = "application/json;odata=nometadata"
)

func PossibleOdataMetadataFormatValues

func PossibleOdataMetadataFormatValues() []OdataMetadataFormat

PossibleOdataMetadataFormatValues returns the possible values for the OdataMetadataFormat const type.

func (OdataMetadataFormat) ToPtr

ToPtr returns a *OdataMetadataFormat pointing to the current value.

type QueryOptions

type QueryOptions struct {
	// OData filter expression.
	Filter *string
	// Specifies the media type for the response.
	Format *OdataMetadataFormat
	// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId".
	Select *string
	// Maximum number of records to return.
	Top *int32
}

QueryOptions contains a group of parameters for the Table.Query method.

type ResponseFormat

type ResponseFormat string
const (
	ResponseFormatReturnContent   ResponseFormat = "return-content"
	ResponseFormatReturnNoContent ResponseFormat = "return-no-content"
)

func PossibleResponseFormatValues

func PossibleResponseFormatValues() []ResponseFormat

PossibleResponseFormatValues returns the possible values for the ResponseFormat const type.

func (ResponseFormat) ToPtr

func (c ResponseFormat) ToPtr() *ResponseFormat

ToPtr returns a *ResponseFormat pointing to the current value.

type RetentionPolicy

type RetentionPolicy struct {
	// REQUIRED; Indicates whether a retention policy is enabled for the service.
	Enabled *bool `xml:"Enabled"`

	// Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted.
	Days *int32 `xml:"Days"`
}

RetentionPolicy - The retention policy.

type ServiceGetPropertiesOptions

type ServiceGetPropertiesOptions struct {
	// Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when analytics logging is enabled.
	RequestID *string
	// The timeout parameter is expressed in seconds.
	Timeout *int32
}

ServiceGetPropertiesOptions contains the optional parameters for the Service.GetProperties method.

type ServiceGetStatisticsOptions

type ServiceGetStatisticsOptions struct {
	// Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when analytics logging is enabled.
	RequestID *string
	// The timeout parameter is expressed in seconds.
	Timeout *int32
}

ServiceGetStatisticsOptions contains the optional parameters for the Service.GetStatistics method.

type ServiceSetPropertiesOptions

type ServiceSetPropertiesOptions struct {
	// Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when analytics logging is enabled.
	RequestID *string
	// The timeout parameter is expressed in seconds.
	Timeout *int32
}

ServiceSetPropertiesOptions contains the optional parameters for the Service.SetProperties method.

type ServiceSetPropertiesResponse

type ServiceSetPropertiesResponse struct {
	// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
	ClientRequestID *string

	// RawResponse contains the underlying HTTP response.
	RawResponse *http.Response

	// RequestID contains the information returned from the x-ms-request-id header response.
	RequestID *string

	// Version contains the information returned from the x-ms-version header response.
	Version *string
}

ServiceSetPropertiesResponse contains the response from method Service.SetProperties.

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(accountName, accountKey string) (*SharedKeyCredential, error)

NewSharedKeyCredential creates an immutable SharedKeyCredential containing the storage account's name and either its primary or secondary key.

func (*SharedKeyCredential) AccountName

func (c *SharedKeyCredential) AccountName() string

AccountName returns the Storage account's name.

func (*SharedKeyCredential) AuthenticationPolicy

AuthenticationPolicy implements the Credential interface on SharedKeyCredential.

func (*SharedKeyCredential) ComputeHMACSHA256

func (c *SharedKeyCredential) ComputeHMACSHA256(message string) (string, error)

computeHMACSHA256 generates a hash signature for an HTTP request or for a SAS.

func (*SharedKeyCredential) SetAccountKey

func (c *SharedKeyCredential) SetAccountKey(accountKey string) error

SetAccountKey replaces the existing account key with the specified account key.

type SignedIdentifier

type SignedIdentifier struct {
	// REQUIRED; The access policy.
	AccessPolicy *AccessPolicy `xml:"AccessPolicy"`

	// REQUIRED; A unique id.
	ID *string `xml:"Id"`
}

SignedIdentifier - A signed identifier.

type SignedIdentifierArrayResponse

type SignedIdentifierArrayResponse struct {
	// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
	ClientRequestID *string `xml:"ClientRequestID"`

	// Date contains the information returned from the Date header response.
	Date *time.Time `xml:"Date"`

	// RawResponse contains the underlying HTTP response.
	RawResponse *http.Response

	// RequestID contains the information returned from the x-ms-request-id header response.
	RequestID *string `xml:"RequestID"`

	// A collection of signed identifiers.
	SignedIdentifiers []*SignedIdentifier `xml:"SignedIdentifier"`

	// Version contains the information returned from the x-ms-version header response.
	Version *string `xml:"Version"`
}

SignedIdentifierArrayResponse is the response envelope for operations that return a []*SignedIdentifier type.

type TableClient

type TableClient struct {
	Name string
	// contains filtered or unexported fields
}

A TableClient represents a client to the tables service affinitized to a specific table.

func NewTableClient

func NewTableClient(tableName string, serviceURL string, cred azcore.Credential, options *TableClientOptions) (*TableClient, error)

NewTableClient creates a TableClient struct in the context of the table specified in tableName, using the specified serviceURL, credential, and options.

func (*TableClient) AddEntity

func (t *TableClient) AddEntity(ctx context.Context, entity interface{}) (TableInsertEntityResponse, error)

AddEntity adds an entity from an arbitrary interface value to the table. An entity must have at least a PartitionKey and RowKey property.

func (*TableClient) Create

Create creates the table with the tableName specified when NewTableClient was called.

func (*TableClient) Delete

Delete deletes the table with the tableName specified when NewTableClient was called.

func (*TableClient) DeleteEntity

func (t *TableClient) DeleteEntity(ctx context.Context, partitionKey string, rowKey string, etag string) (TableDeleteEntityResponse, error)

DeleteEntity deletes the entity with the specified partitionKey and rowKey from the table.

func (*TableClient) GetEntity

func (t *TableClient) GetEntity(ctx context.Context, partitionKey string, rowKey string) (MapOfInterfaceResponse, error)

GetEntity retrieves a specific entity from the service using the specified partitionKey and rowKey values.

func (*TableClient) Query

func (t *TableClient) Query(queryOptions *QueryOptions) TableEntityQueryResponsePager

Query queries the tables using the specified QueryOptions. QueryOptions can specify the following properties to affect the query results returned:

Filter: An Odata filter expression that limits results to those entities that satisfy the filter expression. For example, the following expression would return only entities with a PartitionKey of 'foo': "PartitionKey eq 'foo'"

Select: A comma delimited list of entity property names that selects which set of entity properties to return in the result set. For example, the following value would return results containing only the PartitionKey and RowKey properties: "PartitionKey, RowKey"

Top: The maximum number of entities that will be returned per page of results. Note: This value does not limit the total number of results if NextPage is called on the returned Pager until it returns false.

Query returns a Pager, which allows iteration through each page of results. Example:

pager := client.Query(nil)

for pager.NextPage(ctx) {
    resp = pager.PageResponse()
    fmt.sprintf("The page contains %i results", len(resp.TableEntityQueryResponse.Value))
}

err := pager.Err()

func (*TableClient) SubmitTransaction

func (t *TableClient) SubmitTransaction(ctx context.Context, transactionActions []TableTransactionAction, tableSubmitTransactionOptions *TableSubmitTransactionOptions) (TableTransactionResponse, error)

SubmitTransaction submits the table transactional batch according to the slice of TableTransactionActions provided.

func (*TableClient) UpdateEntity

func (t *TableClient) UpdateEntity(ctx context.Context, entity map[string]interface{}, etag *string, updateMode TableUpdateMode) (interface{}, error)

UpdateEntity updates the specified table entity if it exists. If updateMode is Replace, the entity will be replaced. This is the only way to remove properties from an existing entity. If updateMode is Merge, the property values present in the specified entity will be merged with the existing entity. Properties not specified in the merge will be unaffected. The specified etag value will be used for optimistic concurrency. If the etag does not match the value of the entity in the table, the operation will fail. The response type will be TableEntityMergeResponse if updateMode is Merge and TableEntityUpdateResponse if updateMode is Replace.

func (*TableClient) UpsertEntity

func (t *TableClient) UpsertEntity(ctx context.Context, entity map[string]interface{}, updateMode TableUpdateMode) (interface{}, error)

UpsertEntity replaces the specified table entity if it exists or creates the entity if it does not exist. If the entity exists and updateMode is Merge, the property values present in the specified entity will be merged with the existing entity rather than replaced. The response type will be TableEntityMergeResponse if updateMode is Merge and TableEntityUpdateResponse if updateMode is Replace.

type TableClientOptions

type TableClientOptions 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
}

type TableCreateOptions

type TableCreateOptions struct {
	// Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when analytics logging is enabled.
	RequestID *string
	// Specifies whether the response should include the inserted entity in the payload. Possible values are return-no-content and return-content.
	ResponsePreference *ResponseFormat
}

TableCreateOptions contains the optional parameters for the Table.Create method.

type TableCreateResponse

type TableCreateResponse struct {
	// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
	ClientRequestID *string

	// Date contains the information returned from the Date header response.
	Date *time.Time

	// PreferenceApplied contains the information returned from the Preference-Applied header response.
	PreferenceApplied *string

	// RawResponse contains the underlying HTTP response.
	RawResponse *http.Response

	// RequestID contains the information returned from the x-ms-request-id header response.
	RequestID *string

	// Version contains the information returned from the x-ms-version header response.
	Version *string
}

TableCreateResponse contains the response from method Table.Create.

type TableDeleteEntityOptions

type TableDeleteEntityOptions struct {
	// Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when analytics logging is enabled.
	RequestID *string
	// The timeout parameter is expressed in seconds.
	Timeout *int32
}

TableDeleteEntityOptions contains the optional parameters for the Table.DeleteEntity method.

type TableDeleteEntityResponse

type TableDeleteEntityResponse struct {
	// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
	ClientRequestID *string

	// Date contains the information returned from the Date header response.
	Date *time.Time

	// RawResponse contains the underlying HTTP response.
	RawResponse *http.Response

	// RequestID contains the information returned from the x-ms-request-id header response.
	RequestID *string

	// Version contains the information returned from the x-ms-version header response.
	Version *string
}

TableDeleteEntityResponse contains the response from method Table.DeleteEntity.

type TableDeleteOptions

type TableDeleteOptions struct {
	// Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when analytics logging is enabled.
	RequestID *string
}

TableDeleteOptions contains the optional parameters for the Table.Delete method.

type TableDeleteResponse

type TableDeleteResponse struct {
	// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
	ClientRequestID *string

	// Date contains the information returned from the Date header response.
	Date *time.Time

	// RawResponse contains the underlying HTTP response.
	RawResponse *http.Response

	// RequestID contains the information returned from the x-ms-request-id header response.
	RequestID *string

	// Version contains the information returned from the x-ms-version header response.
	Version *string
}

TableDeleteResponse contains the response from method Table.Delete.

type TableEntityQueryResponse

type TableEntityQueryResponse struct {
	// The metadata response of the table.
	OdataMetadata *string `json:"odata.metadata,omitempty"`

	// List of table entities.
	Value []map[string]interface{} `json:"value,omitempty"`
}

TableEntityQueryResponse - The properties for the table entity query response.

func (*TableEntityQueryResponse) AsModels

func (r *TableEntityQueryResponse) AsModels(modelSlice interface{}) error

AsModels converts each map[string]interface{} entity result into a strongly slice of strongly typed models The modelSlice parameter should be a pointer to a slice of struct types that match the entity model type in the table response.

func (TableEntityQueryResponse) MarshalJSON

func (t TableEntityQueryResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TableEntityQueryResponse.

type TableEntityQueryResponsePager

type TableEntityQueryResponsePager interface {
	azcore.Pager

	// PageResponse returns the current TableQueryResponseResponse.
	PageResponse() TableEntityQueryResponseResponse
}

TableEntityQueryResponsePager is a Pager for Table entity query results.

NextPage should be called first. It fetches the next available page of results from the service. If the fetched page contains results, the return value is true, else false. Results fetched from the service can be evaluated by calling PageResponse on this Pager. If the result is false, the value of Err() will indicate if an error occurred.

PageResponse returns the results from the page most recently fetched from the service. Example usage of this in combination with NextPage would look like the following:

for pager.NextPage(ctx) {
    resp = pager.PageResponse()
    fmt.sprintf("The page contains %i results", len(resp.TableEntityQueryResponse.Value))
}

err := pager.Err()

type TableEntityQueryResponseResponse

type TableEntityQueryResponseResponse struct {
	// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
	ClientRequestID *string

	// Date contains the information returned from the Date header response.
	Date *time.Time

	// RawResponse contains the underlying HTTP response.
	RawResponse *http.Response

	// RequestID contains the information returned from the x-ms-request-id header response.
	RequestID *string

	// The properties for the table entity query response.
	TableEntityQueryResponse *TableEntityQueryResponse

	// Version contains the information returned from the x-ms-version header response.
	Version *string

	// XMSContinuationNextPartitionKey contains the information returned from the x-ms-continuation-NextPartitionKey header response.
	XMSContinuationNextPartitionKey *string

	// XMSContinuationNextRowKey contains the information returned from the x-ms-continuation-NextRowKey header response.
	XMSContinuationNextRowKey *string
}

TableEntityQueryResponseResponse is the response envelope for operations that return a TableEntityQueryResponse type.

type TableGetAccessPolicyOptions

type TableGetAccessPolicyOptions struct {
	// Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when analytics logging is enabled.
	RequestID *string
	// The timeout parameter is expressed in seconds.
	Timeout *int32
}

TableGetAccessPolicyOptions contains the optional parameters for the Table.GetAccessPolicy method.

type TableInsertEntityOptions

type TableInsertEntityOptions struct {
	// Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when analytics logging is enabled.
	RequestID *string
	// Specifies whether the response should include the inserted entity in the payload. Possible values are return-no-content and return-content.
	ResponsePreference *ResponseFormat
	// The properties for the table entity.
	TableEntityProperties map[string]interface{}
	// The timeout parameter is expressed in seconds.
	Timeout *int32
}

TableInsertEntityOptions contains the optional parameters for the Table.InsertEntity method.

type TableInsertEntityResponse

type TableInsertEntityResponse struct {
	// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
	ClientRequestID *string

	// ContentType contains the information returned from the Content-Type header response.
	ContentType *string

	// Date contains the information returned from the Date header response.
	Date *time.Time

	// ETag contains the information returned from the ETag header response.
	ETag *string

	// PreferenceApplied contains the information returned from the Preference-Applied header response.
	PreferenceApplied *string

	// RawResponse contains the underlying HTTP response.
	RawResponse *http.Response

	// RequestID contains the information returned from the x-ms-request-id header response.
	RequestID *string

	// Version contains the information returned from the x-ms-version header response.
	Version *string
}

TableInsertEntityResponse contains the response from method Table.InsertEntity.

type TableMergeEntityOptions

type TableMergeEntityOptions struct {
	// Match condition for an entity to be updated. If specified and a matching entity is not found, an error will be raised. To force an unconditional update,
	// set to the wildcard character (*). If not specified, an insert will be performed when no existing entity is found to update and a merge will be performed
	// if an existing entity is found.
	IfMatch *string
	// Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when analytics logging is enabled.
	RequestID *string
	// The properties for the table entity.
	TableEntityProperties map[string]interface{}
	// The timeout parameter is expressed in seconds.
	Timeout *int32
}

TableMergeEntityOptions contains the optional parameters for the Table.MergeEntity method.

type TableMergeEntityResponse

type TableMergeEntityResponse struct {
	// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
	ClientRequestID *string

	// Date contains the information returned from the Date header response.
	Date *time.Time

	// ETag contains the information returned from the ETag header response.
	ETag *string

	// RawResponse contains the underlying HTTP response.
	RawResponse *http.Response

	// RequestID contains the information returned from the x-ms-request-id header response.
	RequestID *string

	// Version contains the information returned from the x-ms-version header response.
	Version *string
}

TableMergeEntityResponse contains the response from method Table.MergeEntity.

type TableProperties

type TableProperties struct {
	// The name of the table to create.
	TableName *string `json:"TableName,omitempty"`
}

TableProperties - The properties for creating a table.

type TableQueryEntitiesOptions

type TableQueryEntitiesOptions struct {
	// An entity query continuation token from a previous call.
	NextPartitionKey *string
	// An entity query continuation token from a previous call.
	NextRowKey *string
	// Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when analytics logging is enabled.
	RequestID *string
	// The timeout parameter is expressed in seconds.
	Timeout *int32
}

TableQueryEntitiesOptions contains the optional parameters for the Table.QueryEntities method.

type TableQueryEntityWithPartitionAndRowKeyOptions

type TableQueryEntityWithPartitionAndRowKeyOptions struct {
	// Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when analytics logging is enabled.
	RequestID *string
	// The timeout parameter is expressed in seconds.
	Timeout *int32
}

TableQueryEntityWithPartitionAndRowKeyOptions contains the optional parameters for the Table.QueryEntityWithPartitionAndRowKey method.

type TableQueryOptions

type TableQueryOptions struct {
	// A table query continuation token from a previous call.
	NextTableName *string
	// Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when analytics logging is enabled.
	RequestID *string
}

TableQueryOptions contains the optional parameters for the Table.Query method.

type TableQueryResponse

type TableQueryResponse struct {
	// The metadata response of the table.
	OdataMetadata *string `json:"odata.metadata,omitempty"`

	// List of tables.
	Value []*TableResponseProperties `json:"value,omitempty"`
}

TableQueryResponse - The properties for the table query response.

func (TableQueryResponse) MarshalJSON

func (t TableQueryResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TableQueryResponse.

type TableQueryResponsePager

type TableQueryResponsePager interface {
	azcore.Pager

	// PageResponse returns the current TableQueryResponseResponse.
	PageResponse() TableQueryResponseResponse
}

TableQueryResponsePager is a Pager for Table Queries

NextPage should be called first. It fetches the next available page of results from the service. If the fetched page contains results, the return value is true, else false. Results fetched from the service can be evaluated by calling PageResponse on this Pager. If the result is false, the value of Err() will indicate if an error occurred.

PageResponse returns the results from the page most recently fetched from the service. Example usage of this in combination with NextPage would look like the following:

for pager.NextPage(ctx) {
    resp = pager.PageResponse()
    fmt.sprintf("The page contains %i results", len(resp.TableEntityQueryResponse.Value))
}

err := pager.Err()

type TableQueryResponseResponse

type TableQueryResponseResponse struct {
	// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
	ClientRequestID *string

	// Date contains the information returned from the Date header response.
	Date *time.Time

	// RawResponse contains the underlying HTTP response.
	RawResponse *http.Response

	// RequestID contains the information returned from the x-ms-request-id header response.
	RequestID *string

	// The properties for the table query response.
	TableQueryResponse *TableQueryResponse

	// Version contains the information returned from the x-ms-version header response.
	Version *string

	// XMSContinuationNextTableName contains the information returned from the x-ms-continuation-NextTableName header response.
	XMSContinuationNextTableName *string
}

TableQueryResponseResponse is the response envelope for operations that return a TableQueryResponse type.

type TableResponse

type TableResponse struct {
	TableResponseProperties
	// The metadata response of the table.
	OdataMetadata *string `json:"odata.metadata,omitempty"`
}

TableResponse - The response for a single table.

type TableResponseProperties

type TableResponseProperties struct {
	// The edit link of the table.
	OdataEditLink *string `json:"odata.editLink,omitempty"`

	// The id of the table.
	OdataID *string `json:"odata.id,omitempty"`

	// The odata type of the table.
	OdataType *string `json:"odata.type,omitempty"`

	// The name of the table.
	TableName *string `json:"TableName,omitempty"`
}

TableResponseProperties - The properties for the table response.

type TableResponseResponse

type TableResponseResponse struct {
	// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
	ClientRequestID *string

	// Date contains the information returned from the Date header response.
	Date *time.Time

	// PreferenceApplied contains the information returned from the Preference-Applied header response.
	PreferenceApplied *string

	// RawResponse contains the underlying HTTP response.
	RawResponse *http.Response

	// RequestID contains the information returned from the x-ms-request-id header response.
	RequestID *string

	// The response for a single table.
	TableResponse *TableResponse

	// Version contains the information returned from the x-ms-version header response.
	Version *string
}

TableResponseResponse is the response envelope for operations that return a TableResponse type.

type TableServiceClient

type TableServiceClient struct {
	// contains filtered or unexported fields
}

A TableServiceClient represents a client to the table service. It can be used to query the available tables, add/remove tables, and various other service level operations.

func NewTableServiceClient

func NewTableServiceClient(serviceURL string, cred azcore.Credential, options *TableClientOptions) (*TableServiceClient, error)

NewTableServiceClient creates a TableServiceClient struct using the specified serviceURL, credential, and options.

func (*TableServiceClient) Create

Create creates a table with the specified name.

func (*TableServiceClient) Delete

Delete deletes a table by name.

func (*TableServiceClient) NewTableClient

func (t *TableServiceClient) NewTableClient(tableName string) *TableClient

NewTableClient returns a pointer to a TableClient affinitzed to the specified table name and initialized with the same serviceURL and credentials as this TableServiceClient

func (*TableServiceClient) Query

Query queries the existing tables using the specified QueryOptions. QueryOptions can specify the following properties to affect the query results returned:

Filter: An Odata filter expression that limits results to those tables that satisfy the filter expression. For example, the following expression would return only tables with a TableName of 'foo': "TableName eq 'foo'"

Top: The maximum number of tables that will be returned per page of results. Note: This value does not limit the total number of results if NextPage is called on the returned Pager until it returns false.

Query returns a Pager, which allows iteration through each page of results. Example:

pager := client.Query(nil)

for pager.NextPage(ctx) {
    resp = pager.PageResponse()
    fmt.sprintf("The page contains %i results", len(resp.TableQueryResponse.Value))
}

err := pager.Err()

type TableServiceError

type TableServiceError struct {

	// The error message.
	Message *string `json:"Message,omitempty"`
	// contains filtered or unexported fields
}

TableServiceError - Table Service error. Implements the error and azcore.HTTPResponse interfaces.

func (TableServiceError) Error

func (e TableServiceError) Error() string

Error implements the error interface for type TableServiceError. The contents of the error text are not contractual and subject to change.

type TableServiceProperties

type TableServiceProperties struct {
	// The set of CORS rules.
	Cors []*CorsRule `xml:"Cors>CorsRule"`

	// A summary of request statistics grouped by API in hourly aggregates for tables.
	HourMetrics *Metrics `xml:"HourMetrics"`

	// Azure Analytics Logging settings.
	Logging *Logging `xml:"Logging"`

	// A summary of request statistics grouped by API in minute aggregates for tables.
	MinuteMetrics *Metrics `xml:"MinuteMetrics"`
}

TableServiceProperties - Table Service Properties.

func (TableServiceProperties) MarshalXML

func (t TableServiceProperties) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaller interface for type TableServiceProperties.

type TableServicePropertiesResponse

type TableServicePropertiesResponse struct {
	// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
	ClientRequestID *string `xml:"ClientRequestID"`

	// RawResponse contains the underlying HTTP response.
	RawResponse *http.Response

	// RequestID contains the information returned from the x-ms-request-id header response.
	RequestID *string `xml:"RequestID"`

	// Table Service Properties.
	StorageServiceProperties *TableServiceProperties `xml:"StorageServiceProperties"`

	// Version contains the information returned from the x-ms-version header response.
	Version *string `xml:"Version"`
}

TableServicePropertiesResponse is the response envelope for operations that return a TableServiceProperties type.

type TableServiceStats

type TableServiceStats struct {
	// Geo-Replication information for the Secondary Storage Service.
	GeoReplication *GeoReplication `xml:"GeoReplication"`
}

TableServiceStats - Stats for the service.

type TableServiceStatsResponse

type TableServiceStatsResponse struct {
	// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
	ClientRequestID *string `xml:"ClientRequestID"`

	// Date contains the information returned from the Date header response.
	Date *time.Time `xml:"Date"`

	// RawResponse contains the underlying HTTP response.
	RawResponse *http.Response

	// RequestID contains the information returned from the x-ms-request-id header response.
	RequestID *string `xml:"RequestID"`

	// Stats for the service.
	StorageServiceStats *TableServiceStats `xml:"StorageServiceStats"`

	// Version contains the information returned from the x-ms-version header response.
	Version *string `xml:"Version"`
}

TableServiceStatsResponse is the response envelope for operations that return a TableServiceStats type.

type TableSetAccessPolicyOptions

type TableSetAccessPolicyOptions struct {
	// Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when analytics logging is enabled.
	RequestID *string
	// The acls for the table.
	TableACL []*SignedIdentifier
	// The timeout parameter is expressed in seconds.
	Timeout *int32
}

TableSetAccessPolicyOptions contains the optional parameters for the Table.SetAccessPolicy method.

type TableSetAccessPolicyResponse

type TableSetAccessPolicyResponse struct {
	// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
	ClientRequestID *string

	// Date contains the information returned from the Date header response.
	Date *time.Time

	// RawResponse contains the underlying HTTP response.
	RawResponse *http.Response

	// RequestID contains the information returned from the x-ms-request-id header response.
	RequestID *string

	// Version contains the information returned from the x-ms-version header response.
	Version *string
}

TableSetAccessPolicyResponse contains the response from method Table.SetAccessPolicy.

type TableSubmitTransactionOptions

type TableSubmitTransactionOptions struct {
	RequestID *string
}

type TableTransactionAction

type TableTransactionAction struct {
	ActionType TableTransactionActionType
	Entity     map[string]interface{}
	ETag       string
}

type TableTransactionActionType

type TableTransactionActionType string
const (
	Add           TableTransactionActionType = "add"
	UpdateMerge   TableTransactionActionType = "updatemerge"
	UpdateReplace TableTransactionActionType = "updatereplace"
	Delete        TableTransactionActionType = "delete"
	UpsertMerge   TableTransactionActionType = "upsertmerge"
	UpsertReplace TableTransactionActionType = "upsertreplace"
)

type TableTransactionError

type TableTransactionError struct {
	OdataError        OdataError `json:"odata.error"`
	FailedEntityIndex int
}

func (*TableTransactionError) Error

func (e *TableTransactionError) Error() string

type TableTransactionResponse

type TableTransactionResponse struct {
	// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
	ClientRequestID *string

	// Date contains the information returned from the Date header response.
	Date *time.Time

	// PreferenceApplied contains the information returned from the Preference-Applied header response.
	PreferenceApplied *string

	// RawResponse contains the underlying HTTP response.
	RawResponse *http.Response

	// RequestID contains the information returned from the x-ms-request-id header response.
	RequestID *string

	// The response for a single table.
	TransactionResponses *[]azcore.Response

	// Version contains the information returned from the x-ms-version header response.
	Version *string

	// ContentType contains the information returned from the Content-Type header response.
	ContentType *string
}

type TableUpdateEntityOptions

type TableUpdateEntityOptions struct {
	// Match condition for an entity to be updated. If specified and a matching entity is not found, an error will be raised. To force an unconditional update,
	// set to the wildcard character (*). If not specified, an insert will be performed when no existing entity is found to update and a replace will be performed
	// if an existing entity is found.
	IfMatch *string
	// Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when analytics logging is enabled.
	RequestID *string
	// The properties for the table entity.
	TableEntityProperties map[string]interface{}
	// The timeout parameter is expressed in seconds.
	Timeout *int32
}

TableUpdateEntityOptions contains the optional parameters for the Table.UpdateEntity method.

type TableUpdateEntityResponse

type TableUpdateEntityResponse struct {
	// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
	ClientRequestID *string

	// Date contains the information returned from the Date header response.
	Date *time.Time

	// ETag contains the information returned from the ETag header response.
	ETag *string

	// RawResponse contains the underlying HTTP response.
	RawResponse *http.Response

	// RequestID contains the information returned from the x-ms-request-id header response.
	RequestID *string

	// Version contains the information returned from the x-ms-version header response.
	Version *string
}

TableUpdateEntityResponse contains the response from method Table.UpdateEntity.

type TableUpdateMode

type TableUpdateMode string
const (
	Replace TableUpdateMode = "replace"
	Merge   TableUpdateMode = "merge"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL