cosmosdb

package
v1.0.77 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2024 License: GPL-3.0 Imports: 8 Imported by: 1

Documentation

Index

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL