cosmos

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package cosmos implements the Azure Cosmos DB SQL data-plane REST API against a CloudEmu database driver. Real azure-sdk-for-go/sdk/data/azcosmos clients configured with a custom endpoint hit this handler the same way they hit {account}.documents.azure.com.

Supported operations (parity with AWS DynamoDB):

Databases:  POST /dbs, GET /dbs, GET /dbs/{db}, DELETE /dbs/{db}
Containers: POST /dbs/{db}/colls, GET /dbs/{db}/colls, GET .../{c}, DELETE .../{c}
Items:      POST /dbs/{db}/colls/{c}/docs   (also Query with x-ms-documentdb-isquery)
            GET .../docs, GET .../docs/{id}
            PUT .../docs/{id}, DELETE .../docs/{id}

The driver doesn't model Cosmos's database-level grouping, so we expose a single virtual database "cloudemu" that always exists and contains every driver table as a container.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler serves Cosmos DB SQL API requests against a database driver.

func New

func New(db dbdriver.Database) *Handler

New returns a Cosmos handler backed by db.

func (*Handler) Matches

func (*Handler) Matches(r *http.Request) bool

Matches returns true for the Cosmos data plane URLs we serve: the account root probe (GET /) and the /dbs/... resource tree.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP routes the request based on URL path shape.

Jump to

Keyboard shortcuts

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