Documentation ¶
Index ¶
- type ClientInterface
- type ContainerClientInterface
- type CosmosClient
- type CosmosContainer
- func (c *CosmosContainer) CreateItem(ctx context.Context, partitionKey azcosmos.PartitionKey, item interface{}, ...) (azcosmos.ItemResponse, error)
- func (c *CosmosContainer) DeleteItem(ctx context.Context, partitionKey azcosmos.PartitionKey, id string, ...) (azcosmos.ItemResponse, error)
- func (c *CosmosContainer) ReadItem(ctx context.Context, partitionKey azcosmos.PartitionKey, id string, ...) (azcosmos.ItemResponse, error)
- func (c *CosmosContainer) UpsertItem(ctx context.Context, partitionKey azcosmos.PartitionKey, item interface{}, ...) (azcosmos.ItemResponse, error)
- type CosmosDatabase
- type CosmosdbRepository
- func (r *CosmosdbRepository) CreateDocument(ctx context.Context, partitionKey string, document interface{}) error
- func (r *CosmosdbRepository) DeleteDocument(ctx context.Context, partitionKey string, id string) error
- func (r *CosmosdbRepository) GetDocument(ctx context.Context, partitionKey string, id string) (interface{}, error)
- func (r *CosmosdbRepository) UpdateDocument(ctx context.Context, partitionKey string, id string, document interface{}) error
- type DatabaseClientInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientInterface ¶
type ClientInterface interface { NewDatabase(id string) (DatabaseClientInterface, error) Endpoint() string }
CosmosDB client interface
type ContainerClientInterface ¶
type ContainerClientInterface interface { CreateItem(ctx context.Context, partitionKey azcosmos.PartitionKey, item interface{}, options *azcosmos.ItemOptions) (azcosmos.ItemResponse, error) UpsertItem(ctx context.Context, partitionKey azcosmos.PartitionKey, item interface{}, options *azcosmos.ItemOptions) (azcosmos.ItemResponse, error) DeleteItem(ctx context.Context, partitionKey azcosmos.PartitionKey, id string, options *azcosmos.ItemOptions) (azcosmos.ItemResponse, error) ReadItem(ctx context.Context, partitionKey azcosmos.PartitionKey, id string, options *azcosmos.ItemOptions) (azcosmos.ItemResponse, error) }
CosmosDB container, with all methods to interact with the container (CRUD operations)
type CosmosClient ¶
type CosmosClient struct {
// contains filtered or unexported fields
}
ClientInterface implementation
func (*CosmosClient) Endpoint ¶
func (c *CosmosClient) Endpoint() string
func (*CosmosClient) NewDatabase ¶
func (c *CosmosClient) NewDatabase(id string) (DatabaseClientInterface, error)
type CosmosContainer ¶
type CosmosContainer struct {
// contains filtered or unexported fields
}
func (*CosmosContainer) CreateItem ¶
func (c *CosmosContainer) CreateItem(ctx context.Context, partitionKey azcosmos.PartitionKey, item interface{}, options *azcosmos.ItemOptions) (azcosmos.ItemResponse, error)
func (*CosmosContainer) DeleteItem ¶
func (c *CosmosContainer) DeleteItem(ctx context.Context, partitionKey azcosmos.PartitionKey, id string, options *azcosmos.ItemOptions) (azcosmos.ItemResponse, error)
func (*CosmosContainer) ReadItem ¶
func (c *CosmosContainer) ReadItem(ctx context.Context, partitionKey azcosmos.PartitionKey, id string, options *azcosmos.ItemOptions) (azcosmos.ItemResponse, error)
func (*CosmosContainer) UpsertItem ¶
func (c *CosmosContainer) UpsertItem(ctx context.Context, partitionKey azcosmos.PartitionKey, item interface{}, options *azcosmos.ItemOptions) (azcosmos.ItemResponse, error)
type CosmosDatabase ¶
type CosmosDatabase struct {
// contains filtered or unexported fields
}
func (*CosmosDatabase) NewContainer ¶
func (d *CosmosDatabase) NewContainer(id string) (ContainerClientInterface, error)
type CosmosdbRepository ¶
type CosmosdbRepository struct {
// contains filtered or unexported fields
}
CosmosDB repository
func NewCosmosdbRepository ¶
func NewCosmosdbRepository(ctx context.Context, endPoint, connectionString, databaseName, containerName string) (*CosmosdbRepository, error)
Initialize CosmosDB repository using the provided connection string
func (*CosmosdbRepository) CreateDocument ¶
func (r *CosmosdbRepository) CreateDocument(ctx context.Context, partitionKey string, document interface{}) error
Creates a new document in CosmosDB
func (*CosmosdbRepository) DeleteDocument ¶
func (r *CosmosdbRepository) DeleteDocument(ctx context.Context, partitionKey string, id string) error
Deletes an document from CosmosDB
func (*CosmosdbRepository) GetDocument ¶
func (r *CosmosdbRepository) GetDocument(ctx context.Context, partitionKey string, id string) (interface{}, error)
Retrieves an document from CosmosDB
func (*CosmosdbRepository) UpdateDocument ¶
func (r *CosmosdbRepository) UpdateDocument(ctx context.Context, partitionKey string, id string, document interface{}) error
Updates an existing document in CosmosDB
type DatabaseClientInterface ¶
type DatabaseClientInterface interface {
NewContainer(id string) (ContainerClientInterface, error)
}
Database client interface, used to create a new container
Click to show internal directories.
Click to hide internal directories.