cosmosdb

package
v0.0.0-...-54afde0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrETagRequired = fmt.Errorf("ETag is required")

ErrETagRequired is the error returned if the ETag field is not populate on a PUT or DELETE operation

Functions

func IsErrorStatusCode

func IsErrorStatusCode(err error, statusCode int) bool

IsErrorStatusCode returns true if err is of type Error and its StatusCode matches statusCode

func RetryOnPreconditionFailed

func RetryOnPreconditionFailed(f func() error) (err error)

RetryOnPreconditionFailed retries a function if it fails due to PreconditionFailed

Types

type AsyncOperationDocumentClient

AsyncOperationDocumentClient is a asyncOperationDocument client

func NewAsyncOperationDocumentClient

func NewAsyncOperationDocumentClient(collc CollectionClient, collid string) AsyncOperationDocumentClient

NewAsyncOperationDocumentClient returns a new asyncOperationDocument client

type AsyncOperationDocumentIterator

type AsyncOperationDocumentIterator interface {
	Next(context.Context) (*pkg.AsyncOperationDocuments, error)
}

AsyncOperationDocumentIterator is a asyncOperationDocument iterator

type AsyncOperationDocumentRawIterator

type AsyncOperationDocumentRawIterator interface {
	AsyncOperationDocumentIterator
	NextRaw(context.Context, interface{}) error
}

AsyncOperationDocumentRawIterator is a asyncOperationDocument raw iterator

type BillingDocumentClient

BillingDocumentClient is a billingDocument client

func NewBillingDocumentClient

func NewBillingDocumentClient(collc CollectionClient, collid string) BillingDocumentClient

NewBillingDocumentClient returns a new billingDocument client

type BillingDocumentIterator

type BillingDocumentIterator interface {
	Next(context.Context) (*pkg.BillingDocuments, error)
}

BillingDocumentIterator is a billingDocument iterator

type BillingDocumentRawIterator

type BillingDocumentRawIterator interface {
	BillingDocumentIterator
	NextRaw(context.Context, interface{}) error
}

BillingDocumentRawIterator is a billingDocument raw iterator

type Collection

type Collection struct {
	ID                       string                    `json:"id,omitempty"`
	ResourceID               string                    `json:"_rid,omitempty"`
	Timestamp                int                       `json:"_ts,omitempty"`
	Self                     string                    `json:"_self,omitempty"`
	ETag                     string                    `json:"_etag,omitempty"`
	Documents                string                    `json:"_docs,omitempty"`
	StoredProcedures         string                    `json:"_sprocs,omitempty"`
	Triggers                 string                    `json:"_triggers,omitempty"`
	UserDefinedFunctions     string                    `json:"_udfs,omitempty"`
	Conflicts                string                    `json:"_conflicts,omitempty"`
	IndexingPolicy           *IndexingPolicy           `json:"indexingPolicy,omitempty"`
	PartitionKey             *PartitionKey             `json:"partitionKey,omitempty"`
	ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"`
	GeospatialConfig         *GeospatialConfig         `json:"geospatialConfig,omitempty"`
}

Collection represents a collection

type CollectionClient

type CollectionClient interface {
	Create(context.Context, *Collection) (*Collection, error)
	List() CollectionIterator
	ListAll(context.Context) (*Collections, error)
	Get(context.Context, string) (*Collection, error)
	Delete(context.Context, *Collection) error
	Replace(context.Context, *Collection) (*Collection, error)
	PartitionKeyRanges(context.Context, string) (*PartitionKeyRanges, error)
}

CollectionClient is a collection client

func NewCollectionClient

func NewCollectionClient(c DatabaseClient, dbid string) CollectionClient

NewCollectionClient returns a new collection client

type CollectionIterator

type CollectionIterator interface {
	Next(context.Context) (*Collections, error)
}

CollectionIterator is a collection iterator

type Collections

type Collections struct {
	Count       int           `json:"_count,omitempty"`
	ResourceID  string        `json:"_rid,omitempty"`
	Collections []*Collection `json:"DocumentCollections,omitempty"`
}

Collections represents collections

type ConflictResolutionPolicy

type ConflictResolutionPolicy struct {
	Mode                        ConflictResolutionPolicyMode `json:"mode,omitempty"`
	ConflictResolutionPath      string                       `json:"conflictResolutionPath,omitempty"`
	ConflictResolutionProcedure string                       `json:"conflictResolutionProcedure,omitempty"`
}

ConflictResolutionPolicy represents a conflict resolution policy

type ConflictResolutionPolicyMode

type ConflictResolutionPolicyMode string

ConflictResolutionPolicyMode represents a conflict resolution policy mode

const (
	ConflictResolutionPolicyModeLastWriterWins ConflictResolutionPolicyMode = "LastWriterWins"
	ConflictResolutionPolicyModeCustom         ConflictResolutionPolicyMode = "Custom"
)

ConflictResolutionPolicyMode constants

type Database

type Database struct {
	ID          string `json:"id,omitempty"`
	ResourceID  string `json:"_rid,omitempty"`
	Timestamp   int    `json:"_ts,omitempty"`
	Self        string `json:"_self,omitempty"`
	ETag        string `json:"_etag,omitempty"`
	Collections string `json:"_colls,omitempty"`
	Users       string `json:"_users,omitempty"`
}

Database represents a database

type DatabaseClient

type DatabaseClient interface {
	Create(context.Context, *Database) (*Database, error)
	List() DatabaseIterator
	ListAll(context.Context) (*Databases, error)
	Get(context.Context, string) (*Database, error)
	Delete(context.Context, *Database) error
}

DatabaseClient is a database client

func NewDatabaseClient

func NewDatabaseClient(log *logrus.Entry, hc *http.Client, jsonHandle *codec.JsonHandle, databaseAccount, masterKey string) (DatabaseClient, error)

NewDatabaseClient returns a new database client

type DatabaseIterator

type DatabaseIterator interface {
	Next(context.Context) (*Databases, error)
}

DatabaseIterator is a database iterator

type Databases

type Databases struct {
	Count      int         `json:"_count,omitempty"`
	ResourceID string      `json:"_rid,omitempty"`
	Databases  []*Database `json:"Databases,omitempty"`
}

Databases represents databases

type Error

type Error struct {
	StatusCode int
	Code       string `json:"code"`
	Message    string `json:"message"`
}

Error represents an error

func (*Error) Error

func (e *Error) Error() string

type ExcludedPath

type ExcludedPath struct {
	Path string `json:"path,omitempty"`
}

ExcludedPath represents an excluded path

type GeospatialConfig

type GeospatialConfig struct {
	Type GeospatialConfigType `json:"type,omitempty"`
}

GeospatialConfig represents a geospatial config

type GeospatialConfigType

type GeospatialConfigType string

GeospatialConfigType represents geospatial config types

const (
	GeospatialConfigTypeGeography GeospatialConfigType = "Geography"
)

GeospatialConfigType constants

type IncludedPath

type IncludedPath struct {
	Path    string  `json:"path,omitempty"`
	Indexes []Index `json:"indexes,omitempty"`
}

IncludedPath represents an included path

type Index

type Index struct {
	DataType  IndexDataType `json:"dataType,omitempty"`
	Kind      IndexKind     `json:"kind,omitempty"`
	Precision int           `json:"precision,omitempty"`
}

Index represents an index

type IndexDataType

type IndexDataType string

IndexDataType represents an index data type

const (
	IndexDataTypeString     IndexDataType = "String"
	IndexDataTypeNumber     IndexDataType = "Number"
	IndexDataTypePoint      IndexDataType = "Point"
	IndexDataTypePolygon    IndexDataType = "Polygon"
	IndexDataTypeLineString IndexDataType = "LineString"
)

IndexDataType constants

type IndexKind

type IndexKind string

IndexKind represents an index kind

const (
	IndexKindHash    IndexKind = "Hash"
	IndexKindRange   IndexKind = "Range"
	IndexKindSpatial IndexKind = "Spatial"
)

IndexKind constants

type IndexingPolicy

type IndexingPolicy struct {
	Automatic     bool               `json:"automatic,omitempty"`
	IndexingMode  IndexingPolicyMode `json:"indexingMode,omitempty"`
	IncludedPaths []IncludedPath     `json:"includedPaths,omitempty"`
	ExcludedPaths []IncludedPath     `json:"excludedPaths,omitempty"`
}

IndexingPolicy represents an indexing policy

type IndexingPolicyMode

type IndexingPolicyMode string

IndexingPolicyMode represents an indexing policy mode

const (
	IndexingPolicyModeConsistent IndexingPolicyMode = "Consistent"
	IndexingPolicyModeLazy       IndexingPolicyMode = "Lazy"
)

IndexingPolicyMode constants

type MonitorDocumentClient

MonitorDocumentClient is a monitorDocument client

func NewMonitorDocumentClient

func NewMonitorDocumentClient(collc CollectionClient, collid string) MonitorDocumentClient

NewMonitorDocumentClient returns a new monitorDocument client

type MonitorDocumentIterator

type MonitorDocumentIterator interface {
	Next(context.Context) (*pkg.MonitorDocuments, error)
}

MonitorDocumentIterator is a monitorDocument iterator

type MonitorDocumentRawIterator

type MonitorDocumentRawIterator interface {
	MonitorDocumentIterator
	NextRaw(context.Context, interface{}) error
}

MonitorDocumentRawIterator is a monitorDocument raw iterator

type OpenShiftClusterDocumentClient

OpenShiftClusterDocumentClient is a openShiftClusterDocument client

func NewOpenShiftClusterDocumentClient

func NewOpenShiftClusterDocumentClient(collc CollectionClient, collid string) OpenShiftClusterDocumentClient

NewOpenShiftClusterDocumentClient returns a new openShiftClusterDocument client

type OpenShiftClusterDocumentIterator

type OpenShiftClusterDocumentIterator interface {
	Next(context.Context) (*pkg.OpenShiftClusterDocuments, error)
}

OpenShiftClusterDocumentIterator is a openShiftClusterDocument iterator

type OpenShiftClusterDocumentRawIterator

type OpenShiftClusterDocumentRawIterator interface {
	OpenShiftClusterDocumentIterator
	NextRaw(context.Context, interface{}) error
}

OpenShiftClusterDocumentRawIterator is a openShiftClusterDocument raw iterator

type Options

type Options struct {
	NoETag              bool
	PreTriggers         []string
	PostTriggers        []string
	PartitionKeyRangeID string
}

Options represents API options

type Parameter

type Parameter struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}

Parameter represents a parameter

type PartitionKey

type PartitionKey struct {
	Paths   []string         `json:"paths,omitempty"`
	Kind    PartitionKeyKind `json:"kind,omitempty"`
	Version int              `json:"version,omitempty"`
}

PartitionKey represents a partition key

type PartitionKeyKind

type PartitionKeyKind string

PartitionKeyKind represents a partition key kind

const (
	PartitionKeyKindHash PartitionKeyKind = "Hash"
)

PartitionKeyKind constants

type PartitionKeyRange

type PartitionKeyRange struct {
	ID                 string                  `json:"id,omitempty"`
	ResourceID         string                  `json:"_rid,omitempty"`
	Timestamp          int                     `json:"_ts,omitempty"`
	Self               string                  `json:"_self,omitempty"`
	ETag               string                  `json:"_etag,omitempty"`
	MaxExclusive       string                  `json:"maxExclusive,omitempty"`
	MinInclusive       string                  `json:"minInclusive,omitempty"`
	ResourceIDPrefix   int                     `json:"ridPrefix,omitempty"`
	ThroughputFraction int                     `json:"throughputFraction,omitempty"`
	Status             PartitionKeyRangeStatus `json:"status,omitempty"`
	Parents            []string                `json:"parents,omitempty"`
}

PartitionKeyRange represents a partition key range

type PartitionKeyRangeStatus

type PartitionKeyRangeStatus string

PartitionKeyRangeStatus represents a partition key range status

const (
	PartitionKeyRangeStatusOnline PartitionKeyRangeStatus = "online"
)

PartitionKeyRangeStatus constants

type PartitionKeyRanges

type PartitionKeyRanges struct {
	Count              int                 `json:"_count,omitempty"`
	ResourceID         string              `json:"_rid,omitempty"`
	PartitionKeyRanges []PartitionKeyRange `json:"PartitionKeyRanges,omitempty"`
}

PartitionKeyRanges represents partition key ranges

type Query

type Query struct {
	Query      string      `json:"query,omitempty"`
	Parameters []Parameter `json:"parameters,omitempty"`
}

Query represents a query

type SubscriptionDocumentClient

SubscriptionDocumentClient is a subscriptionDocument client

func NewSubscriptionDocumentClient

func NewSubscriptionDocumentClient(collc CollectionClient, collid string) SubscriptionDocumentClient

NewSubscriptionDocumentClient returns a new subscriptionDocument client

type SubscriptionDocumentIterator

type SubscriptionDocumentIterator interface {
	Next(context.Context) (*pkg.SubscriptionDocuments, error)
}

SubscriptionDocumentIterator is a subscriptionDocument iterator

type SubscriptionDocumentRawIterator

type SubscriptionDocumentRawIterator interface {
	SubscriptionDocumentIterator
	NextRaw(context.Context, interface{}) error
}

SubscriptionDocumentRawIterator is a subscriptionDocument raw iterator

type Trigger

type Trigger struct {
	ID               string           `json:"id,omitempty"`
	ResourceID       string           `json:"_rid,omitempty"`
	Timestamp        int              `json:"_ts,omitempty"`
	Self             string           `json:"_self,omitempty"`
	ETag             string           `json:"_etag,omitempty"`
	Body             string           `json:"body,omitempty"`
	TriggerOperation TriggerOperation `json:"triggerOperation,omitempty"`
	TriggerType      TriggerType      `json:"triggerType,omitempty"`
}

Trigger represents a trigger

type TriggerClient

type TriggerClient interface {
	Create(context.Context, *Trigger) (*Trigger, error)
	List() TriggerIterator
	ListAll(context.Context) (*Triggers, error)
	Get(context.Context, string) (*Trigger, error)
	Delete(context.Context, *Trigger) error
	Replace(context.Context, *Trigger) (*Trigger, error)
}

TriggerClient is a trigger client

func NewTriggerClient

func NewTriggerClient(collc CollectionClient, collid string) TriggerClient

NewTriggerClient returns a new trigger client

type TriggerIterator

type TriggerIterator interface {
	Next(context.Context) (*Triggers, error)
}

TriggerIterator is a trigger iterator

type TriggerOperation

type TriggerOperation string

TriggerOperation represents a trigger operation

const (
	TriggerOperationAll     TriggerOperation = "All"
	TriggerOperationCreate  TriggerOperation = "Create"
	TriggerOperationReplace TriggerOperation = "Replace"
	TriggerOperationDelete  TriggerOperation = "Delete"
)

TriggerOperation constants

type TriggerType

type TriggerType string

TriggerType represents a trigger type

const (
	TriggerTypePre  TriggerType = "Pre"
	TriggerTypePost TriggerType = "Post"
)

TriggerType constants

type Triggers

type Triggers struct {
	Count      int        `json:"_count,omitempty"`
	ResourceID string     `json:"_rid,omitempty"`
	Triggers   []*Trigger `json:"Triggers,omitempty"`
}

Triggers represents triggers

Jump to

Keyboard shortcuts

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