Documentation ¶
Index ¶
- Variables
- func HandleAzCosmosError(err error) error
- func NewAzCosmosSingleContainerDocService(client *azcosmos.ContainerClient) *azcosmosSingleContainerDocService
- type ContextKey
- type CosmosQueryBuilder
- func (b *CosmosQueryBuilder) BuildQuery() (string, []azcosmos.QueryParameter)
- func (b *CosmosQueryBuilder) WithExtraColumns(columns ...string) *CosmosQueryBuilder
- func (b *CosmosQueryBuilder) WithOffsetLimit(offset uint, limit uint) *CosmosQueryBuilder
- func (b *CosmosQueryBuilder) WithOrderBy(clause string) *CosmosQueryBuilder
- func (b *CosmosQueryBuilder) WithWhereClauses(clauses ...string) *CosmosQueryBuilder
- type DocIdentifier
- type DocPager
- type DocService
- type ETag
- type HexBytes
- type LinkResourceDoc
- type NumericDate
- type PartitionKey
- type ResourceDoc
- type ResourceDocument
- type ResourceQueryDoc
- type ResourceQueryDocument
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidPartitionKey = errors.New("invalid partition key") ErrInvalidIdentifier = errors.New("invalid identifier") )
View Source
var (
ErrAzCosmosDocNotFound = errors.New("az cosmos doc not found")
)
Functions ¶
func HandleAzCosmosError ¶
func NewAzCosmosSingleContainerDocService ¶
func NewAzCosmosSingleContainerDocService(client *azcosmos.ContainerClient) *azcosmosSingleContainerDocService
Types ¶
type CosmosQueryBuilder ¶
type CosmosQueryBuilder struct { Columns []string WhereClauses []string OrderBy string Parameters []azcosmos.QueryParameter OffsetLimitClause string }
func NewDefaultCosmoQueryBuilder ¶
func NewDefaultCosmoQueryBuilder() *CosmosQueryBuilder
func (*CosmosQueryBuilder) BuildQuery ¶
func (b *CosmosQueryBuilder) BuildQuery() (string, []azcosmos.QueryParameter)
func (*CosmosQueryBuilder) WithExtraColumns ¶
func (b *CosmosQueryBuilder) WithExtraColumns(columns ...string) *CosmosQueryBuilder
func (*CosmosQueryBuilder) WithOffsetLimit ¶
func (b *CosmosQueryBuilder) WithOffsetLimit(offset uint, limit uint) *CosmosQueryBuilder
func (*CosmosQueryBuilder) WithOrderBy ¶
func (b *CosmosQueryBuilder) WithOrderBy(clause string) *CosmosQueryBuilder
func (*CosmosQueryBuilder) WithWhereClauses ¶
func (b *CosmosQueryBuilder) WithWhereClauses(clauses ...string) *CosmosQueryBuilder
type DocIdentifier ¶
type DocIdentifier struct { PartitionKey ID string }
func NewDocIdentifier ¶
func NewDocIdentifier(nsProvider models.NamespaceProvider, nsID string, rProvider models.ResourceProvider, id string) DocIdentifier
func ParseIdentifier ¶
func ParseIdentifier(text string) (identifier DocIdentifier, err error)
func (*DocIdentifier) IsEmpty ¶
func (p *DocIdentifier) IsEmpty() bool
func (DocIdentifier) MarshalText ¶
func (p DocIdentifier) MarshalText() ([]byte, error)
func (DocIdentifier) String ¶
func (p DocIdentifier) String() string
func (*DocIdentifier) UnmarshalText ¶
func (p *DocIdentifier) UnmarshalText(text []byte) (err error)
type DocPager ¶
type DocPager[D ResourceQueryDocument] struct { // contains filtered or unexported fields }
func NewQueryDocPager ¶
func NewQueryDocPager[D ResourceQueryDocument](c context.Context, queryBuilder *CosmosQueryBuilder, partitionKey PartitionKey) *DocPager[D]
func ToDocPager ¶
func ToDocPager[D ResourceQueryDocument](pager *azruntime.Pager[azcosmos.QueryItemsResponse]) *DocPager[D]
type DocService ¶
type DocService interface { Read(c context.Context, identifier DocIdentifier, dst ResourceDocument, opts *azcosmos.ItemOptions) error Create(context.Context, ResourceDocument, *azcosmos.ItemOptions) (azcosmos.ItemResponse, error) Upsert(context.Context, ResourceDocument, *azcosmos.ItemOptions) (azcosmos.ItemResponse, error) NewQueryItemsPager(query string, partitionKey PartitionKey, o *azcosmos.QueryOptions) *azruntime.Pager[azcosmos.QueryItemsResponse] Delete(context.Context, DocIdentifier, *azcosmos.ItemOptions) (azcosmos.ItemResponse, error) Patch(context.Context, ResourceDocument, azcosmos.PatchOperations, *azcosmos.ItemOptions) (azcosmos.ItemResponse, error) PatchByIdentifier(context.Context, DocIdentifier, azcosmos.PatchOperations, *azcosmos.ItemOptions) (azcosmos.ItemResponse, error) }
func GetDocService ¶
func GetDocService(c context.Context) DocService
type HexBytes ¶
type HexBytes []byte
func (HexBytes) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*HexBytes) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type LinkResourceDoc ¶
type LinkResourceDoc struct { ResourceDoc LinkTo DocIdentifier `json:"linkTo"` LinkProvider models.LinkProvider `json:"linkProvider"` }
func (*LinkResourceDoc) ToModel ¶
func (doc *LinkResourceDoc) ToModel() (m models.LinkRef)
type NumericDate ¶
type NumericDate = jwt.NumericDate
type PartitionKey ¶
type PartitionKey struct { NamespaceProvider models.NamespaceProvider NamespaceID string ResourceProvider models.ResourceProvider }
func ParsePartitionKey ¶
func ParsePartitionKey(text string) (PartitionKey, error)
func (*PartitionKey) IsEmpty ¶
func (p *PartitionKey) IsEmpty() bool
func (PartitionKey) MarshalText ¶
func (p PartitionKey) MarshalText() ([]byte, error)
func (PartitionKey) String ¶
func (p PartitionKey) String() string
func (*PartitionKey) UnmarshalText ¶
func (p *PartitionKey) UnmarshalText(text []byte) (err error)
type ResourceDoc ¶
type ResourceDoc struct { PartitionKey PartitionKey `json:"namespaceId"` ID string `json:"id"` Timestamp *jwt.NumericDate `json:"_ts,omitempty"` ETag *ETag `json:"_etag,omitempty"` Deleted *time.Time `json:"deleted,omitempty"` UpdatedBy string `json:"updatedBy,omitempty"` }
Docs are IDed by the following (?<partitionID>:)<namespaceProvider>:<namespaceID>:<resourceProvider>/<resourceID>
func (*ResourceDoc) GetETag ¶
func (doc *ResourceDoc) GetETag() *azcore.ETag
GetETag implements ResourceDocument.
func (*ResourceDoc) Identifier ¶
func (doc *ResourceDoc) Identifier() DocIdentifier
func (*ResourceDoc) ToRef ¶
func (doc *ResourceDoc) ToRef() (ref models.Ref)
type ResourceDocument ¶
type ResourceDocument interface { Identifier() DocIdentifier GetETag() *azcore.ETag // contains filtered or unexported methods }
type ResourceQueryDoc ¶
type ResourceQueryDoc struct { ID string `json:"id"` Timestamp jwt.NumericDate `json:"_ts"` Deleted *time.Time `json:"deleted"` }
func (*ResourceQueryDoc) ToRef ¶
func (d *ResourceQueryDoc) ToRef() (m models.Ref)
// PopulateModelRef implements ModelRefPopulater.
type ResourceQueryDocument ¶
type ResourceQueryDocument interface { }
Click to show internal directories.
Click to hide internal directories.