Versions in this module Expand all Collapse all v0 v0.0.1 May 7, 2021 Changes in this version + const ConsistencyLevelBounded + const ConsistencyLevelEventual + const ConsistencyLevelSession + const ConsistencyLevelStrong + const HEADER_AUTH + const HEADER_A_IM + const HEADER_CHARGE + const HEADER_CONLEN + const HEADER_CONSISTENCY_LEVEL + const HEADER_CONTINUATION + const HEADER_CONTYPE + const HEADER_CROSSPARTITION + const HEADER_ETAG + const HEADER_IF_MATCH + const HEADER_IF_NONE_MATCH + const HEADER_INDEXINGDIRECTIVE + const HEADER_IS_QUERY + const HEADER_MAX_ITEM_COUNT + const HEADER_OFFER_THROUGHPUT + const HEADER_OFFER_TYPE + const HEADER_PARTITIONKEY + const HEADER_PARTITION_KEY_RANGE_ID + const HEADER_REQUEST_CHARGE + const HEADER_SESSION_TOKEN + const HEADER_TRIGGER_POST_EXCLUDE + const HEADER_TRIGGER_POST_INCLUDE + const HEADER_TRIGGER_PRE_EXCLUDE + const HEADER_TRIGGER_PRE_INCLUDE + const HEADER_UPSERT + const HEADER_VER + const HEADER_XDATE + const Hash + const IndexingDirectiveExclude + const IndexingDirectiveInclude + const LineStringType + const MaxPrecision + const NumberType + const PointType + const PolygonType + const QUERY_CONTENT_TYPE + const Range + const Spatial + const StatusRetryWith + const StringType + var CosmosHTTPErrors = map[int]error + var ErrConflict = errors.New("The ID provided has been taken by an existing resource") + var ErrForbidden = errors.New(...) + var ErrGone = errors.New("Resource is gone") + var ErrInternalError = errors.New("The operation failed due to an unexpected service error") + var ErrInvalidPartitionKeyType = errors.New("Partition key type must be a simple type (nil, string, int, float, etc.)") + var ErrInvalidRequest = errors.New("The JSON, SQL, or JavaScript in the request body is invalid") + var ErrMaxRetriesExceeded = errors.New("Max retries exceeded") + var ErrNotFound = errors.New("Resource that no longer exists") + var ErrPreconditionFailed = errors.New(...) + var ErrRetryWith = errors.New(...) + var ErrThroughputRequiresPartitionKey = errors.New("Must specify PartitionKey when OfferThroughput is >= 10000") + var ErrTimeout = errors.New("The operation did not complete within the allotted amount of time") + var ErrTooLarge = errors.New(...) + var ErrTooManyRequests = errors.New("The collection has exceeded the provisioned throughput limit") + var ErrUnautorized = errors.New("The Authorization header is invalid for the requested resource") + var ErrUnavailable = errors.New("The operation could not be completed because the service was unavailable") + var ErrWrongQueryContentType = errors.New("Wrong content type. Must be " + QUERY_CONTENT_TYPE) + var ErrorNotImplemented = errors.New("not implemented") + var IgnoreContext bool + var ReqOpAllowCrossPartition = RequestOption("x-ms-documentdb-query-enablecrosspartition") + var ReqOpPartitionKey = RequestOption(HEADER_PARTITIONKEY) + var ResponseHook func(ctx context.Context, method string, headers map[string][]string) + func CreateCollLink(dbName, collName string) string + func CreateTriggerLink(dbName, collName, triggerName string) string + func EscapeJavaScript(source []byte) string + func MarshalPartitionKeyHeader(partitionKeyValue interface{}) (string, error) + type AuthorizationPayload struct + Date string + ResourceLink string + ResourceType string + Verb string + type Client struct + Client *http.Client + Config Config + Log logging.ExtendedLogger + Url string + func New(url string, cfg Config, cl *http.Client, log logging.StdLogger) *Client + func (c *Client) CreateCollection(ctx context.Context, dbName string, colOps CreateCollectionOptions) (CreateCollectionResponse, error) + func (c *Client) CreateDatabase(ctx context.Context, dbName string, ops *RequestOptions) (*Database, error) + func (c *Client) CreateDocument(ctx context.Context, dbName, colName string, doc interface{}, ...) (*Resource, DocumentResponse, error) + func (c *Client) CreateStoredProcedure(ctx context.Context, dbName, colName, sprocName, body string) (*StoredProcedure, error) + func (c *Client) CreateTrigger(ctx context.Context, dbName string, colName string, ...) (*Trigger, error) + func (c *Client) DeleteCollection(ctx context.Context, dbName, colName string) error + func (c *Client) DeleteDatabase(ctx context.Context, dbName string, ops *RequestOptions) error + func (c *Client) DeleteDocument(ctx context.Context, dbName, colName, id string, ops DeleteDocumentOptions) (DocumentResponse, error) + func (c *Client) DeleteStoredProcedure(ctx context.Context, dbName, colName, sprocName string) error + func (c *Client) DeleteTrigger(ctx context.Context, dbName, colName string) error + func (c *Client) ExecuteStoredProcedure(ctx context.Context, dbName, colName, sprocName string, ...) error + func (c *Client) GetCollection(ctx context.Context, dbName, colName string) (*Collection, error) + func (c *Client) GetDatabase(ctx context.Context, dbName string, ops *RequestOptions) (*Database, error) + func (c *Client) GetDocument(ctx context.Context, dbName, colName, id string, ops GetDocumentOptions, ...) (DocumentResponse, error) + func (c *Client) GetOffer(ctx context.Context, offerId string, ops *RequestOptions) (*Offer, error) + func (c *Client) GetPartitionKeyRanges(ctx context.Context, databaseName, collectionName string, ...) (response GetPartitionKeyRangesResponse, err error) + func (c *Client) GetStoredProcedure(ctx context.Context, dbName, colName, sprocName string) (*StoredProcedure, error) + func (c *Client) ListCollections(ctx context.Context, dbName string, options ListCollectionsOptions) (ListCollectionsResponse, error) + func (c *Client) ListDatabases(ctx context.Context, ops *RequestOptions) ([]Database, error) + func (c *Client) ListDocuments(ctx context.Context, databaseName, collectionName string, ...) (response ListDocumentsResponse, err error) + func (c *Client) ListOffers(ctx context.Context, ops *RequestOptions) (*Offers, error) + func (c *Client) ListStoredProcedures(ctx context.Context, dbName, colName string) (*StoredProcedures, error) + func (c *Client) ListTriggers(ctx context.Context, dbName string, colName string) (*CollectionTriggers, error) + func (c *Client) NewPartitionKeyRangesPaginator(databaseName, collectionName string, options *GetPartitionKeyRangesOptions) *PartitionKeyRangesPaginator + func (c *Client) QueryDocuments(ctx context.Context, dbName, collName string, qry Query, docs interface{}, ...) (QueryDocumentsResponse, error) + func (c *Client) ReplaceCollection(ctx context.Context, dbName string, colOps CollectionReplaceOptions) (*Collection, error) + func (c *Client) ReplaceDocument(ctx context.Context, dbName, colName, id string, doc interface{}, ...) (*Resource, DocumentResponse, error) + func (c *Client) ReplaceOffer(ctx context.Context, offerOps OfferReplaceOptions, ops *RequestOptions) (*Offer, error) + func (c *Client) ReplaceStoredProcedure(ctx context.Context, dbName, colName, sprocName, body string) (*StoredProcedure, error) + func (c *Client) ReplaceTrigger(ctx context.Context, dbName, colName string, trigOps TriggerReplaceOptions) (*Trigger, error) + func (c *Client) UpsertDocument(ctx context.Context, link string, doc interface{}, ops *RequestOptions) error + type Collection struct + Conflicts string + Docs string + IndexingPolicy *IndexingPolicy + PartitionKey *PartitionKey + Sprocs string + Triggers string + Udf string + type CollectionReplaceOptions struct + DefaultTimeToLive int + Id string + IndexingPolicy *IndexingPolicy + PartitionKey *PartitionKey + type CollectionTriggers struct + Count int32 + Rid string + Triggers []Trigger + type CompositeIndex []struct + type Config struct + MasterKey string + MaxRetries int + type ConsistencyLevel string + type CreateCollectionOptions struct + DefaultTimeToLive int + Id string + IndexingPolicy *IndexingPolicy + OfferThroughput OfferThroughput + OfferType OfferType + PartitionKey *PartitionKey + type CreateCollectionResponse struct + Collection Collection + type CreateDatabaseOptions struct + ID string + type CreateDocumentOptions struct + IndexingDirective IndexingDirective + IsUpsert bool + PartitionKeyValue interface{} + PostTriggersInclude []string + PreTriggersInclude []string + func (ops CreateDocumentOptions) AsHeaders() (map[string]string, error) + type DataType string + type Database struct + Colls string + Users string + type DeleteDocumentOptions struct + PartitionKeyValue interface{} + PostTriggersInclude []string + PreTriggersInclude []string + func (ops DeleteDocumentOptions) AsHeaders() (map[string]string, error) + type Document struct + Attachments string + type DocumentCollection struct + Count int32 + DocumentCollections []Collection + Rid string + type DocumentResponse struct + RUs float64 + SessionToken string + StatusCode int + type ExcludedPath struct + Path string + type ExecuteStoredProcedureOptions struct + PartitionKeyValue interface{} + func (ops ExecuteStoredProcedureOptions) AsHeaders() (map[string]string, error) + type GetDocumentOptions struct + ConsistencyLevel ConsistencyLevel + IfNoneMatch string + PartitionKeyValue interface{} + SessionToken string + func (ops GetDocumentOptions) AsHeaders() (map[string]string, error) + type GetPartitionKeyRangesOptions struct + Continuation string + MaxItemCount int + func (ops GetPartitionKeyRangesOptions) AsHeaders() (map[string]string, error) + type GetPartitionKeyRangesResponse struct + Continuation string + Etag string + Id string + PartitionKeyRanges []PartitionKeyRange + RequestCharge float64 + Rid string + SessionToken string + type IncludedPath struct + Indexes []Index + Path string + type Index struct + DataType DataType + Kind IndexKind + Precision int + type IndexKind string + type IndexOrder string + const Ascending + const Descending + type IndexingDirective string + type IndexingMode string + type IndexingPolicy struct + Automatic bool + Composite []CompositeIndex + Excluded []ExcludedPath + Included []IncludedPath + IndexingMode IndexingMode + type ListCollectionsOptions struct + Continuation string + MaxItemCount int + type ListCollectionsResponse struct + Collections DocumentCollection + Continuation string + Etag string + RequestCharge float64 + SessionToken string + type ListDocumentsOptions struct + AIM string + Continuation string + IfNoneMatch string + MaxItemCount int + PartitionKeyRangeId string + func (ops ListDocumentsOptions) AsHeaders() (map[string]string, error) + type ListDocumentsResponse struct + Continuation string + Etag string + SessionToken string + type Offer struct + Content OfferThroughputContent + OfferResourceId string + OfferType OfferType + OfferVersion string + type OfferReplaceOptions struct + Content OfferThroughputContent + Id string + OfferResourceId string + OfferType OfferType + OfferVersion string + ResourceSelfLink string + Rid string + type OfferThroughput int32 + type OfferThroughputContent struct + Throughput OfferThroughput + type OfferType string + type Offers struct + Count int32 + Offers []Offer + Rid string + type PartitionKey struct + Kind string + Paths []string + type PartitionKeyRange struct + Id string + MaxExclusive string + MinInclusive string + Parents []string + type PartitionKeyRangesPaginator struct + func (p *PartitionKeyRangesPaginator) CurrentPage(ctx context.Context) (GetPartitionKeyRangesResponse, error) + func (p *PartitionKeyRangesPaginator) Next() bool + type Query struct + Params []QueryParam + Query string + Token string + type QueryDocumentsOptions struct + ConsistencyLevel ConsistencyLevel + ContentType string + Continuation string + EnableCrossPartition bool + IsQuery bool + MaxItemCount int + PartitionKeyValue interface{} + SessionToken string + func DefaultQueryDocumentOptions() QueryDocumentsOptions + type QueryDocumentsResponse struct + Continuation string + Count int + Documents interface{} + type QueryParam struct + Name string + Value interface{} + type ReplaceDocumentOptions struct + ConsistencyLevel ConsistencyLevel + IfMatch string + IndexingDirective IndexingDirective + PartitionKeyValue interface{} + PostTriggersInclude []string + PreTriggersInclude []string + SessionToken string + func (ops ReplaceDocumentOptions) AsHeaders() (map[string]string, error) + type RequestError struct + Code string + Message string + func (e RequestError) Error() string + type RequestOption string + type RequestOptions map[RequestOption]string + type Resource struct + Etag string + Id string + Rid string + Self string + Ts int + type ResponseBase struct + RequestCharge float64 + type Sproc struct + Body string + type StoredProcedure struct + Body string + type StoredProcedures struct + Count int + StoredProcedures []StoredProcedure + type Trigger struct + Body string + Id string + Operation TriggerOperation + Type TriggerType + type TriggerCreateOptions struct + Body string + Id string + Operation TriggerOperation + Type TriggerType + type TriggerOperation string + type TriggerReplaceOptions struct + Body string + Id string + Operation TriggerOperation + Type TriggerType + type TriggerType string + type UDF struct + Body string + type UpsertDocumentOptions struct + PostTriggersInclude []string + PreTriggersInclude []string