Documentation
¶
Index ¶
- Constants
- Variables
- type CallOption
- func ChangeFeed() CallOption
- func ChangeFeedPartitionRangeID(id string) CallOption
- func ConsistencyLevel(consistency Consistency) CallOption
- func Continuation(continuation string) CallOption
- func CrossPartition() CallOption
- func IfMatch(etag string) CallOption
- func IfModifiedSince(date string) CallOption
- func IfNoneMatch(etag string) CallOption
- func Limit(limit int) CallOption
- func PartitionKey(partitionKey interface{}) CallOption
- func SessionToken(sessionToken string) CallOption
- func Upsert() CallOption
- type Client
- type Collection
- func (c *Collection) Delete(ctx context.Context) (*Response, error)
- func (c Collection) Document(docID string) *Document
- func (c Collection) Documents() *Documents
- func (c *Collection) Read(ctx context.Context) (*CollectionDefinition, error)
- func (c *Collection) Replace(ctx context.Context, i *IndexingPolicy, ret interface{}, opts ...CallOption) (*Response, error)
- func (c Collection) StoredProcedure(id string) *StoredProcedure
- func (c Collection) StoredProcedures() *StoredProcedures
- func (c Collection) Trigger(id string) *Trigger
- func (c Collection) Triggers() *Triggers
- func (c Collection) UDF(id string) *UDF
- func (c Collection) UDFs() *UDFs
- type CollectionDefinition
- type CollectionDefinitions
- type Collections
- type Consistency
- type Coordinate
- type Coordinates
- type CosmosErrorMessage
- type Database
- func (d Database) Collection(collID string) *Collection
- func (d Database) Collections() *Collections
- func (d *Database) Delete(ctx context.Context) (*Response, error)
- func (d *Database) Read(ctx context.Context) (*DatabaseDefinition, error)
- func (d Database) User(id string) *User
- func (d Database) Users() *Users
- type DatabaseDefinition
- type DatabaseDefinitions
- type Databases
- func (d *Databases) Create(ctx context.Context, dbID string, opts ...CallOption) (*DatabaseDefinition, error)
- func (d *Databases) Query(ctx context.Context, query *SqlQuerySpec, opts ...CallOption) (*DatabaseDefinitions, error)
- func (d *Databases) ReadAll(ctx context.Context, opts ...CallOption) (*DatabaseDefinitions, error)
- type DecoderFactory
- type Document
- func (d Document) Delete(ctx context.Context, opts ...CallOption) (*Response, error)
- func (d Document) Read(ctx context.Context, ret interface{}, opts ...CallOption) (*Response, error)
- func (d *Document) Replace(ctx context.Context, doc interface{}, ret interface{}, opts ...CallOption) (*Response, error)
- type DocumentDefinition
- type Documents
- func (d *Documents) Create(ctx context.Context, doc interface{}, opts ...CallOption) (*Response, error)
- func (d Documents) Query(ctx context.Context, query *SqlQuerySpec, docs interface{}, opts ...CallOption) (*Response, error)
- func (d *Documents) ReadAll(ctx context.Context, docs interface{}, opts ...CallOption) (*Response, error)
- type EncoderFactory
- type Error
- func (e *Error) BadRequest() bool
- func (e *Error) Conflict() bool
- func (e *Error) Created() bool
- func (e *Error) EntityTooLarge() bool
- func (e *Error) Error() string
- func (e *Error) Forbidden() bool
- func (e *Error) NotFound() bool
- func (e *Error) RequestTimeout() bool
- func (e *Error) RetryWith() bool
- func (e *Error) ServiceUnavailable() bool
- func (e *Error) StatusCode() int
- func (e *Error) StatusOK() bool
- func (e *Error) TooManyRequests() bool
- func (e *Error) Unauthorized() bool
- type Geometry
- type IndexingPolicy
- type IndexingPolicyPath
- type Iterator
- type IteratorFunc
- type JSONDecoder
- type JSONEncoder
- type LineString
- type Marshal
- type MsToken
- type Offer
- type OfferDefinition
- type Offers
- type Option
- type P
- type PartitionKeyDefinition
- type PartitionKeyRange
- type Permission
- func (u *Permission) Delete(ctx context.Context, opts ...CallOption) (*Response, error)
- func (u *Permission) Read(ctx context.Context, opts ...CallOption) (*PermissionDefinition, error)
- func (u *Permission) Replace(ctx context.Context, permission *PermissionDefinition, opts ...CallOption) (*PermissionDefinition, error)
- type PermissionDefinition
- type Permissions
- type Point
- type PolicyIndex
- type Polygon
- type QueryParam
- type Request
- type Resource
- type Response
- type SerializationDriver
- type SqlQuerySpec
- type StoredProcedure
- func (s *StoredProcedure) Delete(ctx context.Context, opts ...CallOption) (*Response, error)
- func (s *StoredProcedure) Execute(ctx context.Context, params, body interface{}, opts ...CallOption) (*Response, error)
- func (s *StoredProcedure) Replace(ctx context.Context, newStoredProcedure *StoredProcedureDefinition, ...) (*StoredProcedureDefinition, error)
- type StoredProcedureDefinition
- type StoredProcedures
- type Trigger
- func (s *Trigger) Delete(ctx context.Context, opts ...CallOption) (*Response, error)
- func (s *Trigger) Execute(ctx context.Context, params, body interface{}, opts ...CallOption) (*Response, error)
- func (s *Trigger) Replace(ctx context.Context, trigger *TriggerDefintion, opts ...CallOption) (*TriggerDefintion, error)
- type TriggerDefintion
- type Triggers
- type UDF
- type UDFDefinition
- type UDFs
- type Unmarshal
- type User
- func (u *User) Delete(ctx context.Context, opts ...CallOption) (*Response, error)
- func (u User) Permission(id string) *Permission
- func (u User) Permissions() *Permissions
- func (u *User) Read(ctx context.Context, opts ...CallOption) (*UserDefinition, error)
- func (u *User) Replace(ctx context.Context, user *UserDefinition, opts ...CallOption) (*UserDefinition, error)
- type UserDefinition
- type Users
Constants ¶
const ( HeaderXDate = "X-Ms-Date" HeaderAuth = "Authorization" HeaderVersion = "X-Ms-Version" HeaderContentType = "Content-Type" HeaderContentLength = "Content-Length" HeaderIsQuery = "X-Ms-Documentdb-Isquery" HeaderUpsert = "x-ms-documentdb-is-upsert" HeaderPartitionKey = "x-ms-documentdb-partitionkey" HeaderMaxItemCount = "x-ms-max-item-count" HeaderContinuation = "x-ms-continuation" HeaderConsistency = "x-ms-consistency-level" HeaderSessionToken = "x-ms-session-token" HeaderCrossPartition = "x-ms-documentdb-query-enablecrosspartition" HeaderIfMatch = "If-Match" HeaderIfNonMatch = "If-None-Match" HeaderIfModifiedSince = "If-Modified-Since" HeaderActivityID = "x-ms-activity-id" HeaderRequestCharge = "x-ms-request-charge" HeaderAIM = "A-IM" HeaderPartitionKeyRangeID = "x-ms-documentdb-partitionkeyrangeid" HeaderRetryAfterMs = "x-ms-retry-after-ms" SupportedVersion = "2018-12-31" )
Variables ¶
var DefaultSerialization = SerializationDriver{ EncoderFactory: func(b *bytes.Buffer) JSONEncoder { return json.NewEncoder(b) }, DecoderFactory: func(r io.Reader) JSONDecoder { return json.NewDecoder(r) }, Marshal: json.Marshal, Unmarshal: json.Unmarshal, }
DefaultSerialization holds default stdlib json driver
var Serialization = DefaultSerialization
Serialization holds driver that is actually used
Functions ¶
This section is empty.
Types ¶
type CallOption ¶
CallOption type defenition.
func ChangeFeedPartitionRangeID ¶
func ChangeFeedPartitionRangeID(id string) CallOption
ChangeFeedPartitionRangeID used in change feed requests. The partition key range ID for reading data.
func ConsistencyLevel ¶
func ConsistencyLevel(consistency Consistency) CallOption
ConsistencyLevel override for read options against documents and attachments. The valid values are: Strong, Bounded, Session, or Eventual (in order of strongest to weakest). The override must be the same or weaker than the account�s configured consistency level.
func Continuation ¶
func Continuation(continuation string) CallOption
Continuation sets continuation token for request
func CrossPartition ¶
func CrossPartition() CallOption
CrossPartition allows query to run on all partitions
func IfMatch ¶
func IfMatch(etag string) CallOption
IfMatch used to make operation conditional for optimistic concurrency. The value should be the etag value of the resource. (applicable only on PUT and DELETE)
func IfModifiedSince ¶
func IfModifiedSince(date string) CallOption
IfModifiedSince returns etag of resource modified after specified date in RFC 1123 format. Ignored when If-None-Match is specified Optional (applicable only on GET)
func IfNoneMatch ¶
func IfNoneMatch(etag string) CallOption
IfNoneMatch makes operation conditional to only execute if the resource has changed. The value should be the etag of the resource. Optional (applicable only on GET)
func PartitionKey ¶
func PartitionKey(partitionKey interface{}) CallOption
PartitionKey sets partition for request
func SessionToken ¶
func SessionToken(sessionToken string) CallOption
SessionToken a string token used with session level consistency.
func Upsert ¶
func Upsert() CallOption
Upsert if set to true, Cosmos DB creates the document with the ID (and partition key value if applicable) if it doesn’t exist, or update the document if it exists.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client model
func (Client) Database ¶
Database returns a new Database struct that contains the opertaions you can do on single database
func (*Client) Databases ¶
Databases returns a new Databases struct used to get data about various databases
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
Collection performs operations on a given collection.
func (*Collection) Delete ¶
func (c *Collection) Delete(ctx context.Context) (*Response, error)
Delete collection
func (Collection) Document ¶
func (c Collection) Document(docID string) *Document
Document defines possible operations on a single document. e.g. Read, Delete, Replace
func (Collection) Documents ¶
func (c Collection) Documents() *Documents
Documents defines possible operations on multiple documents. e.g. ReadAll, Query
func (*Collection) Read ¶
func (c *Collection) Read(ctx context.Context) (*CollectionDefinition, error)
Read returns one collection
func (*Collection) Replace ¶
func (c *Collection) Replace(ctx context.Context, i *IndexingPolicy, ret interface{}, opts ...CallOption) (*Response, error)
Replace collection
func (Collection) StoredProcedure ¶
func (c Collection) StoredProcedure(id string) *StoredProcedure
StoredProcedure defines operations on a single stored procedure
func (Collection) StoredProcedures ¶
func (c Collection) StoredProcedures() *StoredProcedures
StoredProcedures defines operations on multiple stored procedures
func (Collection) Trigger ¶
func (c Collection) Trigger(id string) *Trigger
Trigger defines operations on a single trigger
func (Collection) Triggers ¶
func (c Collection) Triggers() *Triggers
Triggers defines operations on multiple triggers
func (Collection) UDF ¶
func (c Collection) UDF(id string) *UDF
UDF defines operations on a user defined function
func (Collection) UDFs ¶
func (c Collection) UDFs() *UDFs
UDFs defines operations on multiple user defined functions
type CollectionDefinition ¶
type CollectionDefinition struct { Resource IndexingPolicy IndexingPolicy `json:"indexingPolicy,omitempty"` PartitionKey PartitionKeyDefinition `json:"partitionKey,omitempty"` Docs string `json:"_docs,omitempty"` Udf string `json:"_udfs,omitempty"` Sporcs string `json:"_sporcs,omitempty"` Triggers string `json:"_triggers,omitempty"` Conflicts string `json:"_conflicts,omitempty"` }
CollectionDefinition defiens the structure of a Collection
type CollectionDefinitions ¶
type CollectionDefinitions []CollectionDefinition
CollectionDefinitions is a slice of CollectionDefinition elements
func (CollectionDefinitions) At ¶
func (c CollectionDefinitions) At(index int) *CollectionDefinition
At return collection at the specified index
func (*CollectionDefinitions) Length ¶
func (c *CollectionDefinitions) Length() int
Length returns the number of collections.
type Collections ¶
type Collections struct {
// contains filtered or unexported fields
}
Collections struct handles all operations involving mutiple collections
func (*Collections) Create ¶
func (c *Collections) Create(ctx context.Context, newColl *CollectionDefinition) (*CollectionDefinition, error)
Create new collection
func (*Collections) ReadAll ¶
func (c *Collections) ReadAll(ctx context.Context) (*CollectionDefinitions, error)
ReadAll returns all collections in a database.
type Consistency ¶
type Consistency string
Consistency type to define consistency levels
const ( // Strong consistency level Strong Consistency = "strong" // Bounded consistency level Bounded Consistency = "bounded" // Session consistency level Session Consistency = "session" // Eventual consistency level Eventual Consistency = "eventual" )
type Coordinates ¶
type Coordinates []Coordinate
type CosmosErrorMessage ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database performs operations on a single database
func (Database) Collection ¶
func (d Database) Collection(collID string) *Collection
Collection gets a handle for a given collection in a database
func (Database) Collections ¶
func (d Database) Collections() *Collections
Collections gets a handle for doing operations on all collections in a database
type DatabaseDefinition ¶
type DatabaseDefinition struct { Resource Colls string `json:"_colls,omitempty"` Users string `json:"_users,omitempty"` }
DatabaseDefinition defines the structure of a database data query
type DatabaseDefinitions ¶
type DatabaseDefinitions []DatabaseDefinition
DatabaseDefinitions slice of Database elements
func (*DatabaseDefinitions) Length ¶
func (d *DatabaseDefinitions) Length() int
Length returns the number of databases.
type Databases ¶
type Databases struct {
// contains filtered or unexported fields
}
Databases performs operations on databases
func (*Databases) Create ¶
func (d *Databases) Create(ctx context.Context, dbID string, opts ...CallOption) (*DatabaseDefinition, error)
Create a new database
func (*Databases) Query ¶
func (d *Databases) Query(ctx context.Context, query *SqlQuerySpec, opts ...CallOption) (*DatabaseDefinitions, error)
Query databases
func (*Databases) ReadAll ¶
func (d *Databases) ReadAll(ctx context.Context, opts ...CallOption) (*DatabaseDefinitions, error)
ReadAll databases
type DecoderFactory ¶
type DecoderFactory func(io.Reader) JSONDecoder
DecoderFactory describes function that creates json decoder
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
Document performs operations on a given document.
type DocumentDefinition ¶
DocumentDefinition defines all the default document properties.
type Documents ¶
type Documents struct {
// contains filtered or unexported fields
}
Documents performs operations on a multiple documents.
func (*Documents) Create ¶
func (d *Documents) Create(ctx context.Context, doc interface{}, opts ...CallOption) (*Response, error)
Create new document
func (Documents) Query ¶
func (d Documents) Query(ctx context.Context, query *SqlQuerySpec, docs interface{}, opts ...CallOption) (*Response, error)
Query documents
type EncoderFactory ¶
type EncoderFactory func(*bytes.Buffer) JSONEncoder
EncoderFactory describes function that creates json encoder
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error reports cosmos related errors.
func NewCosmosError ¶
func NewCosmosError(message *CosmosErrorMessage, statusCode int) *Error
NewCosmosError creates a new cosmos error struct
func (*Error) BadRequest ¶
BadRequest see `https://docs.microsoft.com/en-us/rest/api/cosmos-db/http-status-codes-for-cosmosdb` for possible cause.
func (*Error) Conflict ¶
Conflict returns true if the ID for a resource has already been taken by an existing resource. Only applicable to PUT and POST request. e.g. Create and Replace.
func (*Error) EntityTooLarge ¶
EntityTooLarge returns true if the request exceeded the allowable document size for a request. the max allowable document size is 2 MB.
func (*Error) Forbidden ¶
Forbidden see `https://docs.microsoft.com/en-us/rest/api/cosmos-db/http-status-codes-for-cosmosdb` for possible cause.
func (*Error) RequestTimeout ¶
RequestTimeout the operation did not complete within the allotted amount of time.
func (*Error) RetryWith ¶
RetryWith returns true if the operation encountered a transient error. This code only occurs on write operations. It is safe to retry the operation.
func (*Error) ServiceUnavailable ¶
ServiceUnavailable operation could not be completed because the service was unavailable
func (*Error) TooManyRequests ¶
The collection has exceeded the provisioned throughput limit. Retry the request after the server specified retry after duration.
func (*Error) Unauthorized ¶
Unauthorized is true of operation was not authorized.
type IndexingPolicy ¶
type IndexingPolicy struct { IndexingMode string `json:"indexingMode,omitempty"` Automatic bool `json:"automatic,omitempty"` IncludedPaths []IndexingPolicyPath `json:"includedPaths,omitempty"` ExcludedPaths []IndexingPolicyPath `json:"excludedPaths,omitempty"` }
IndexingPolicy model
type IndexingPolicyPath ¶
type IndexingPolicyPath struct { Path string `json:"path,omitempty"` Indexes []PolicyIndex `json:"indexes,omitempty"` }
IndexingPolicyPath model
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator used to iterate through documents.
func NewIterator ¶
func NewIterator(docs *Documents, query *SqlQuerySpec, data interface{}, opts ...CallOption) *Iterator
NewIterator creates iterator instance
type IteratorFunc ¶
type IteratorFunc func(docs *Documents, internalOpts ...CallOption) (*Response, error)
IteratorFunc is type that describes iterator source
type JSONDecoder ¶
type JSONDecoder interface {
Decode(obj interface{}) error
}
JSONDecoder describes json decoder
type JSONEncoder ¶
type JSONEncoder interface {
Encode(val interface{}) error
}
JSONEncoder describes json encoder
type LineString ¶
type LineString struct { Type string `json:"type"` Coordinates Coordinates `json:"coordinates"` }
LineString struct defines a line string
func NewLineString ¶
func NewLineString(coords ...Coordinate) *LineString
NewLineString creates a new LineString struct.
func (*LineString) AddPoint ¶
func (l *LineString) AddPoint(lon, lat float64)
AddPoint is a helper method for adding point to a LineString
func (*LineString) Coords ¶
func (l *LineString) Coords() *Coordinates
func (*LineString) GeoType ¶
func (l *LineString) GeoType() string
type Offer ¶
type Offer struct {
// contains filtered or unexported fields
}
func (*Offer) Read ¶
func (o *Offer) Read(ctx context.Context, opts ...CallOption) (*OfferDefinition, error)
func (*Offer) Replace ¶
func (u *Offer) Replace(ctx context.Context, offer *OfferDefinition, opts ...CallOption) (*OfferDefinition, error)
type OfferDefinition ¶
type Offers ¶
type Offers struct {
// contains filtered or unexported fields
}
func (*Offers) Query ¶
func (u *Offers) Query(ctx context.Context, query *SqlQuerySpec, opts ...CallOption) ([]OfferDefinition, error)
func (*Offers) ReadAll ¶
func (o *Offers) ReadAll(ctx context.Context, opts ...CallOption) ([]OfferDefinition, error)
type Option ¶ added in v0.1.1
type Option func(*Client)
Option funcitons for configuring the client
func WithClient ¶ added in v0.1.1
WithClient allows you to provide a custom http client
type P ¶
type P = QueryParam
type PartitionKeyDefinition ¶
PartitionKeyDefinition is used to define a partitionkey.
type PartitionKeyRange ¶
type PartitionKeyRange struct { Resource PartitionKeyRangeID string `json:"id,omitempty"` MinInclusive string `json:"minInclusive,omitempty"` MaxInclusive string `json:"maxExclusive,omitempty"` }
PartitionKeyRange partition key range model
type Permission ¶
type Permission struct {
// contains filtered or unexported fields
}
Permission model
func (*Permission) Delete ¶
func (u *Permission) Delete(ctx context.Context, opts ...CallOption) (*Response, error)
Delete permission.
func (*Permission) Read ¶
func (u *Permission) Read(ctx context.Context, opts ...CallOption) (*PermissionDefinition, error)
Read permission.
func (*Permission) Replace ¶
func (u *Permission) Replace(ctx context.Context, permission *PermissionDefinition, opts ...CallOption) (*PermissionDefinition, error)
Replace permission.
type PermissionDefinition ¶
type PermissionDefinition struct { ID string `json:"id"` PermissionMode string `json:"permissionMode,omitempty"` Resource string `json:"resource"` }
PermissionDefinition model
type Permissions ¶
type Permissions struct {
// contains filtered or unexported fields
}
Permissions model
func (*Permissions) Create ¶
func (u *Permissions) Create(ctx context.Context, permission *PermissionDefinition, opts ...CallOption) (*PermissionDefinition, error)
Create a new permission
func (*Permissions) ReadAll ¶
func (u *Permissions) ReadAll(ctx context.Context, opts ...CallOption) ([]PermissionDefinition, error)
ReadAll permissions.
type Point ¶
type Point struct { Type string `json:"type"` Coordinates Coordinate `json:"coordinates"` }
func NewPoint ¶
func NewPoint(coords Coordinate) *Point
NewPoint creates a new point struct and returns it.
func (*Point) Coords ¶
func (p *Point) Coords() *Coordinate
type PolicyIndex ¶
type PolicyIndex struct { DataType string `json:"dataType,omitempty"` Precision int `json:"precision,omitempty"` Kind string `json:"kind,omitempty"` }
PolicyIndex
type Polygon ¶
type Polygon struct { Type string `json:"type"` Coordinates []Coordinates `json:"coordinates"` }
func NewPolygon ¶
func NewPolygon(coords ...Coordinates) *Polygon
NewPolygon creates a new Polygon struct.
func (*Polygon) Coords ¶
func (p *Polygon) Coords() []Coordinates
type QueryParam ¶
type QueryParam struct { Name string `json:"name"` Value interface{} `json:"value"` }
type Request ¶
func ResourceRequest ¶
Return new resource request with type and id
func (*Request) DefaultHeaders ¶
Add 3 default headers to request "x-ms-date", "x-ms-version", "authorization"
type Resource ¶
type Resource struct { ID string `json:"id,omitempty"` Self string `json:"_self,omitempty"` Etag string `json:"_etag,omitempty"` Rid string `json:"_rid,omitempty"` Ts int `json:"_ts,omitempty"` }
Resource every cosmos resource have these.
type Response ¶
func (*Response) Continuation ¶
Continuation returns continuation token for paged request. Pass this value to next request to get next page of documents.
func (*Response) RetryAfterMs ¶
RetryAfterMs returns the number of seconds until you can try to send the response again only applicable to status code 429 To Many Requests
type SerializationDriver ¶
type SerializationDriver struct { EncoderFactory EncoderFactory DecoderFactory DecoderFactory Marshal Marshal Unmarshal Unmarshal }
SerializationDriver struct holds serialization / deserilization providers
type SqlQuerySpec ¶
type SqlQuerySpec struct { Query string `json:"query"` Parameters []QueryParam `json:"parameters,omitempty"` }
func Q ¶
func Q(query string, queryParams ...QueryParam) *SqlQuerySpec
type StoredProcedure ¶
type StoredProcedure struct {
// contains filtered or unexported fields
}
func (*StoredProcedure) Delete ¶
func (s *StoredProcedure) Delete(ctx context.Context, opts ...CallOption) (*Response, error)
func (*StoredProcedure) Execute ¶
func (s *StoredProcedure) Execute(ctx context.Context, params, body interface{}, opts ...CallOption) (*Response, error)
Execute stored procedure
func (*StoredProcedure) Replace ¶
func (s *StoredProcedure) Replace(ctx context.Context, newStoredProcedure *StoredProcedureDefinition, opts ...CallOption) (*StoredProcedureDefinition, error)
type StoredProcedureDefinition ¶
StoredProcedureDefinition stored procedure model
type StoredProcedures ¶
type StoredProcedures struct {
// contains filtered or unexported fields
}
func (*StoredProcedures) Create ¶
func (s *StoredProcedures) Create(ctx context.Context, newStoredProcedure *StoredProcedureDefinition, opts ...CallOption) (*StoredProcedureDefinition, error)
func (*StoredProcedures) ReadAll ¶
func (s *StoredProcedures) ReadAll(ctx context.Context, opts ...CallOption) ([]StoredProcedureDefinition, error)
type Trigger ¶
type Trigger struct {
// contains filtered or unexported fields
}
func (*Trigger) Execute ¶
func (s *Trigger) Execute(ctx context.Context, params, body interface{}, opts ...CallOption) (*Response, error)
Execute stored procedure
func (*Trigger) Replace ¶
func (s *Trigger) Replace(ctx context.Context, trigger *TriggerDefintion, opts ...CallOption) (*TriggerDefintion, error)
type TriggerDefintion ¶
type TriggerDefintion struct { Resource Body string `json:"body"` TriggerOperation string `json:"triggerOperation"` TriggerType string `json:"triggerType"` }
TriggerDefinition defines the model of a cosmos trigger.
type Triggers ¶
type Triggers struct {
// contains filtered or unexported fields
}
func (*Triggers) Create ¶
func (s *Triggers) Create(ctx context.Context, newTrigger *TriggerDefintion, opts ...CallOption) (*TriggerDefintion, error)
func (*Triggers) ReadAll ¶
func (s *Triggers) ReadAll(ctx context.Context, opts ...CallOption) ([]TriggerDefintion, error)
type UDF ¶
type UDF struct {
// contains filtered or unexported fields
}
func (*UDF) Replace ¶
func (u *UDF) Replace(ctx context.Context, newUDF *UDFDefinition, opts ...CallOption) (*UDFDefinition, error)
type UDFDefinition ¶
UDFDefinition (User Defined Function) definition
type UDFs ¶
type UDFs struct {
// contains filtered or unexported fields
}
func (*UDFs) Create ¶
func (u *UDFs) Create(ctx context.Context, newUDF *UDFDefinition, opts ...CallOption) (*UDFDefinition, error)
func (*UDFs) ReadAll ¶
func (u *UDFs) ReadAll(ctx context.Context, opts ...CallOption) ([]UDFDefinition, error)
type User ¶
type User struct {
// contains filtered or unexported fields
}
func (User) Permission ¶
func (u User) Permission(id string) *Permission
func (User) Permissions ¶
func (u User) Permissions() *Permissions
func (*User) Read ¶
func (u *User) Read(ctx context.Context, opts ...CallOption) (*UserDefinition, error)
Read a single user from collection
func (*User) Replace ¶
func (u *User) Replace(ctx context.Context, user *UserDefinition, opts ...CallOption) (*UserDefinition, error)
Replace an existing user with a new one.
type UserDefinition ¶
type UserDefinition struct { Resource // contains filtered or unexported fields }
type Users ¶
type Users struct {
// contains filtered or unexported fields
}
func (*Users) Create ¶
func (u *Users) Create(ctx context.Context, user *UserDefinition, opts ...CallOption) (*UserDefinition, error)
Create a new user
func (*Users) ReadAll ¶
func (u *Users) ReadAll(ctx context.Context, opts ...CallOption) ([]UserDefinition, error)
ReadAll users in a collection