Versions in this module Expand all Collapse all v1 v1.0.0 Apr 29, 2024 Changes in this version + var ErrETagRequired = fmt.Errorf("ETag is required") + var ErrNotImplemented = fmt.Errorf("not implemented") + func IsErrorStatusCode(err error, statusCode int) bool + func RetryOnHttpStatusOrError(f func() error, statusCode int, errorString ...string) (err error) + func RetryOnPreconditionFailed(f func() error) (err error) + type Authorizer interface + Authorize func(context.Context, *http.Request, string, string) error + func NewMasterKeyAuthorizer(masterKey string) (Authorizer, error) + func NewOauthAADAuthorizer(token *adal.ServicePrincipalToken) Authorizer + func NewOauthMsalAADAuthorizer(token azcore.TokenCredential, cosmosDBInstanceURI string) Authorizer + func NewTokenAuthorizer(token string) Authorizer + type Collection struct + AllowMaterializedViews bool + ConflictResolutionPolicy *ConflictResolutionPolicy + Conflicts string + Documents string + ETag string + GeospatialConfig *GeospatialConfig + ID string + IndexingPolicy *IndexingPolicy + PartitionKey *PartitionKey + ResourceID string + Self string + StoredProcedures string + Timestamp int + Triggers string + UniqueKeyPolicy *UniqueKeyPolicy + UserDefinedFunctions string + type CollectionClient interface + Create func(context.Context, *Collection) (*Collection, error) + Delete func(context.Context, *Collection) error + Get func(context.Context, string) (*Collection, error) + List func() CollectionIterator + ListAll func(context.Context) (*Collections, error) + PartitionKeyRanges func(context.Context, string) (*PartitionKeyRanges, error) + Replace func(context.Context, *Collection) (*Collection, error) + func NewCollectionClient(c DatabaseClient, dbid string) CollectionClient + type CollectionIterator interface + Next func(context.Context) (*Collections, error) + type Collections struct + Collections []*Collection + Count int + ResourceID string + type CompositeIndex []struct + type ConflictResolutionPolicy struct + ConflictResolutionPath string + ConflictResolutionProcedure string + Mode ConflictResolutionPolicyMode + type ConflictResolutionPolicyMode string + const ConflictResolutionPolicyModeCustom + const ConflictResolutionPolicyModeLastWriterWins + type Database struct + Collections string + ETag string + ID string + ResourceID string + Self string + Timestamp int + Users string + type DatabaseClient interface + Create func(context.Context, *Database) (*Database, error) + Delete func(context.Context, *Database) error + Get func(context.Context, string) (*Database, error) + List func() DatabaseIterator + ListAll func(context.Context) (*Databases, error) + SetAuthorizer func(Authorizer) + func NewDatabaseClient(log *logrus.Entry, hc *http.Client, jsonHandle *codec.JsonHandle, ...) DatabaseClient + type DatabaseIterator interface + Next func(context.Context) (*Databases, error) + type Databases struct + Count int + Databases []*Database + ResourceID string + type Error struct + Code string + Message string + StatusCode int + func (e *Error) Error() string + type ExcludedPath struct + Path string + type FakePersonClient struct + func NewFakePersonClient(h *codec.JsonHandle) *FakePersonClient + func (c *FakePersonClient) ChangeFeed(*Options) PersonIterator + func (c *FakePersonClient) Create(ctx context.Context, partitionkey string, person *pkg.Person, options *Options) (*pkg.Person, error) + func (c *FakePersonClient) Delete(ctx context.Context, partitionKey string, person *pkg.Person, options *Options) error + func (c *FakePersonClient) ExecuteStoredProcedure(ctx context.Context, sprocsid string, partitionkey string, parameters []string, ...) (err error) + func (c *FakePersonClient) Get(ctx context.Context, partitionkey string, id string, options *Options) (*pkg.Person, error) + func (c *FakePersonClient) List(*Options) PersonIterator + func (c *FakePersonClient) ListAll(ctx context.Context, options *Options) (*pkg.People, error) + func (c *FakePersonClient) Query(name string, query *Query, options *Options) PersonRawIterator + func (c *FakePersonClient) QueryAll(ctx context.Context, partitionkey string, query *Query, options *Options) (*pkg.People, error) + func (c *FakePersonClient) Replace(ctx context.Context, partitionkey string, person *pkg.Person, options *Options) (*pkg.Person, error) + func (c *FakePersonClient) SetConflictChecker(conflictChecker func(*pkg.Person, *pkg.Person) bool) + func (c *FakePersonClient) SetError(err error) + func (c *FakePersonClient) SetQueryHandler(queryName string, query fakePersonQueryHandler) + func (c *FakePersonClient) SetSorter(sorter func([]*pkg.Person)) + func (c *FakePersonClient) SetTriggerHandler(triggerName string, trigger fakePersonTriggerHandler) + type GeospatialConfig struct + Type GeospatialConfigType + type GeospatialConfigType string + const GeospatialConfigTypeGeography + type IncludedPath struct + Indexes []Index + Path string + type Index struct + DataType IndexDataType + Kind IndexKind + Precision int + type IndexDataType string + const IndexDataTypeLineString + const IndexDataTypeNumber + const IndexDataTypePoint + const IndexDataTypePolygon + const IndexDataTypeString + type IndexKind string + const IndexKindHash + const IndexKindRange + const IndexKindSpatial + type IndexingPolicy struct + Automatic bool + CompositeIndexes []CompositeIndex + ExcludedPaths []IncludedPath + IncludedPaths []IncludedPath + IndexingMode IndexingPolicyMode + type IndexingPolicyMode string + const IndexingPolicyModeConsistent + const IndexingPolicyModeLazy + type MissingFields struct + func (mf *MissingFields) CodecMissingField(field []byte, value interface{}) bool + func (mf *MissingFields) CodecMissingFields() map[string]interface{} + type Options struct + Continuation string + NoETag bool + PartitionKeyRangeID string + PostTriggers []string + PreTriggers []string + type Order string + const OrderAscending + const OrderDescending + type Parameter struct + Name string + Value string + type PartitionKey struct + Kind PartitionKeyKind + Paths []string + Version int + type PartitionKeyKind string + const PartitionKeyKindHash + type PartitionKeyRange struct + ETag string + ID string + LSN int + MaxExclusive string + MinInclusive string + Parents []string + ResourceID string + ResourceIDPrefix int + Self string + Status PartitionKeyRangeStatus + ThroughputFraction float64 + Timestamp int + type PartitionKeyRangeStatus string + const PartitionKeyRangeStatusOnline + type PartitionKeyRanges struct + Count int + PartitionKeyRanges []PartitionKeyRange + ResourceID string + type Permission struct + ETag string + ID string + PermissionMode PermissionMode + Resource string + ResourceID string + Self string + Timestamp int + Token string + type PermissionClient interface + Create func(context.Context, *Permission) (*Permission, error) + Delete func(context.Context, *Permission) error + Get func(context.Context, string) (*Permission, error) + List func() PermissionIterator + ListAll func(context.Context) (*Permissions, error) + Replace func(context.Context, *Permission) (*Permission, error) + func NewPermissionClient(userc UserClient, userid string) PermissionClient + type PermissionIterator interface + Next func(context.Context) (*Permissions, error) + type PermissionMode string + const PermissionModeAll + const PermissionModeRead + type Permissions struct + Count int + Permissions []*Permission + ResourceID string + type PersonClient interface + ChangeFeed func(*Options) PersonIterator + Create func(context.Context, string, *pkg.Person, *Options) (*pkg.Person, error) + Delete func(context.Context, string, *pkg.Person, *Options) error + ExecuteStoredProcedure func(context.Context, string, string, []string, interface{}) error + Get func(context.Context, string, string, *Options) (*pkg.Person, error) + List func(*Options) PersonIterator + ListAll func(context.Context, *Options) (*pkg.People, error) + Query func(string, *Query, *Options) PersonRawIterator + QueryAll func(context.Context, string, *Query, *Options) (*pkg.People, error) + Replace func(context.Context, string, *pkg.Person, *Options) (*pkg.Person, error) + func NewPersonClient(collc CollectionClient, collid string) PersonClient + type PersonIterator interface + Continuation func() string + Next func(context.Context, int) (*pkg.People, error) + type PersonRawIterator interface + NextRaw func(context.Context, int, interface{}) error + func NewFakePersonErroringRawIterator(err error) PersonRawIterator + func NewFakePersonIterator(people []*pkg.Person, continuation int) PersonRawIterator + type Query struct + Parameters []Parameter + Query string + type StoredProcedure struct + Body string + ETag string + ID string + ResourceID string + Self string + Timestamp int + type StoredProcedureClient interface + Create func(context.Context, *StoredProcedure) (*StoredProcedure, error) + Delete func(context.Context, *StoredProcedure) error + Get func(context.Context, string) (*StoredProcedure, error) + List func() StoredProcedureIterator + ListAll func(context.Context) (*StoredProcedures, error) + Replace func(context.Context, *StoredProcedure) (*StoredProcedure, error) + func NewStoredProcedureClient(collc CollectionClient, collid string) StoredProcedureClient + type StoredProcedureIterator interface + Next func(context.Context) (*StoredProcedures, error) + type StoredProcedures struct + Count int + ResourceID string + StoredProcedures []*StoredProcedure + type Trigger struct + Body string + ETag string + ID string + ResourceID string + Self string + Timestamp int + TriggerOperation TriggerOperation + TriggerType TriggerType + type TriggerClient interface + Create func(context.Context, *Trigger) (*Trigger, error) + Delete func(context.Context, *Trigger) error + Get func(context.Context, string) (*Trigger, error) + List func() TriggerIterator + ListAll func(context.Context) (*Triggers, error) + Replace func(context.Context, *Trigger) (*Trigger, error) + func NewTriggerClient(collc CollectionClient, collid string) TriggerClient + type TriggerIterator interface + Next func(context.Context) (*Triggers, error) + type TriggerOperation string + const TriggerOperationAll + const TriggerOperationCreate + const TriggerOperationDelete + const TriggerOperationReplace + type TriggerType string + const TriggerTypePost + const TriggerTypePre + type Triggers struct + Count int + ResourceID string + Triggers []*Trigger + type UniqueKey struct + Paths []string + type UniqueKeyPolicy struct + UniqueKeys []UniqueKey + type User struct + ETag string + ID string + Permissions string + ResourceID string + Self string + Timestamp int + type UserClient interface + Create func(context.Context, *User) (*User, error) + Delete func(context.Context, *User) error + Get func(context.Context, string) (*User, error) + List func() UserIterator + ListAll func(context.Context) (*Users, error) + Replace func(context.Context, *User) (*User, error) + func NewUserClient(c DatabaseClient, dbid string) UserClient + type UserIterator interface + Next func(context.Context) (*Users, error) + type Users struct + Count int + ResourceID string + Users []*User