Versions in this module Expand all Collapse all v0 v0.0.1 May 7, 2021 Changes in this version + const DefaultConflictRetries + var ContentionError = errors.New(...) + var ModelNameRegexp = regexp.MustCompile(`^[a-zA-Z_]+/[0-9]+$`) + var NotImplementedError = errors.New("Not implemented") + var PutWithoutGetError = errors.New("Attempting to put an entity that has not been get first") + func AddMigration(fromPrototype, toPrototype Model, convFunc migrationFunc) (dummyResult struct{}) + func CheckModel(entityPtr Model) string + func Rollback() error + func SessionsMiddleware(next http.Handler) http.Handler + func WithSessions(ctx context.Context) context.Context + type BaseModel cosmosapi.Resource + func (bm *BaseModel) IsNew() bool + type Client interface + CreateDocument func(ctx context.Context, dbName, colName string, doc interface{}, ...) (*cosmosapi.Resource, cosmosapi.DocumentResponse, error) + DeleteCollection func(ctx context.Context, dbName, colName string) error + DeleteDatabase func(ctx context.Context, dbName string, ops *cosmosapi.RequestOptions) error + ExecuteStoredProcedure func(ctx context.Context, dbName, colName, sprocName string, ...) error + GetCollection func(ctx context.Context, dbName, colName string) (*cosmosapi.Collection, error) + GetDocument func(ctx context.Context, dbName, colName, id string, ...) (cosmosapi.DocumentResponse, error) + GetPartitionKeyRanges func(ctx context.Context, dbName, colName string, ...) (cosmosapi.GetPartitionKeyRangesResponse, error) + ListDocuments func(ctx context.Context, dbName, colName string, ...) (cosmosapi.ListDocumentsResponse, error) + ListOffers func(ctx context.Context, ops *cosmosapi.RequestOptions) (*cosmosapi.Offers, error) + QueryDocuments func(ctx context.Context, dbName, collName string, qry cosmosapi.Query, ...) (cosmosapi.QueryDocumentsResponse, error) + ReplaceDocument func(ctx context.Context, dbName, colName, id string, doc interface{}, ...) (*cosmosapi.Resource, cosmosapi.DocumentResponse, error) + ReplaceOffer func(ctx context.Context, offerOps cosmosapi.OfferReplaceOptions, ...) (*cosmosapi.Offer, error) + type Collection struct + Client Client + Context context.Context + DbName string + Name string + PartitionKey string + func (c Collection) ExecuteSproc(sprocName string, partitionKeyValue interface{}, ret interface{}, ...) error + func (c Collection) GetContext() context.Context + func (c Collection) GetEntityInfo(entityPtr Model) (res BaseModel, partitionValue interface{}) + func (c Collection) GetPartitionKeyRanges() ([]cosmosapi.PartitionKeyRange, error) + func (c Collection) Init() Collection + func (c Collection) Query(query string, entities interface{}) (cosmosapi.QueryDocumentsResponse, error) + func (c Collection) RacingPut(entityPtr Model) error + func (c Collection) ReadFeed(etag, partitionKeyRangeId string, maxItems int, documents interface{}) (cosmosapi.ListDocumentsResponse, error) + func (c Collection) ResumeSession(token string) Session + func (c Collection) Session() Session + func (c Collection) SessionContext(ctx context.Context) Session + func (c Collection) StaleGet(partitionValue interface{}, id string, target Model) error + func (c Collection) StaleGetExisting(partitionValue interface{}, id string, target Model) error + func (c Collection) WithContext(ctx context.Context) Collection + type Model interface + IsNew func() bool + PostGet func(txn *Transaction) error + PrePut func(txn *Transaction) error + type Session struct + Collection Collection + ConflictRetries int + Context context.Context + func (session Session) Drop(partitionValue interface{}, id string) + func (session Session) Get(partitionValue interface{}, id string, target Model) error + func (session Session) Token() string + func (session Session) Transaction(closure func(*Transaction) error) error + func (session Session) WithContext(ctx context.Context) Session + func (session Session) WithRetries(n int) Session + type Transaction struct + func (txn *Transaction) Get(partitionValue interface{}, id string, target Model) (err error) + func (txn *Transaction) Put(entityPtr Model)