Documentation
¶
Overview ¶
Package documentdb provides DocumentDB extension integration.
Index ¶
- func CreateUser(ctx context.Context, conn *pgx.Conn, l *slog.Logger, docV wirebson.AnyDocument) (wirebson.RawDocument, error)
- type Conn
- type Pool
- func (p *Pool) Acquire() (*Conn, error)
- func (p *Pool) Aggregate(ctx context.Context, db string, spec wirebson.RawDocument) (wirebson.RawDocument, int64, error)
- func (p *Pool) Close()
- func (p *Pool) Collect(ch chan<- prometheus.Metric)
- func (p *Pool) Describe(ch chan<- *prometheus.Desc)
- func (p *Pool) Find(ctx context.Context, db string, spec wirebson.RawDocument) (wirebson.RawDocument, int64, error)
- func (p *Pool) GetMore(ctx context.Context, db string, spec wirebson.RawDocument, cursorID int64) (wirebson.RawDocument, error)
- func (p *Pool) KillCursor(ctx context.Context, id int64) bool
- func (p *Pool) ListCollections(ctx context.Context, db string, spec wirebson.RawDocument) (wirebson.RawDocument, int64, error)
- func (p *Pool) ListIndexes(ctx context.Context, db string, spec wirebson.RawDocument) (wirebson.RawDocument, int64, error)
- func (p *Pool) WithConn(f func(*pgx.Conn) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateUser ¶
func CreateUser(ctx context.Context, conn *pgx.Conn, l *slog.Logger, docV wirebson.AnyDocument) (wirebson.RawDocument, error)
CreateUser creates a new user. Users with the `clusterAdmin` role are given PostgreSQL's SUPERUSER privileges.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn represents a pooled PostgreSQL connection. It wraps *pgxpool.Conn with resource tracking.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool represent a pool of PostgreSQL connections.
func NewPool ¶
NewPool creates a new pool of PostgreSQL connections. No actual connections are established.
func (*Pool) Acquire ¶
Acquire acquires a connection from the pool.
It is caller's responsibility to call Conn.Release. Most callers should use Pool.WithConn instead.
func (*Pool) Aggregate ¶
func (p *Pool) Aggregate(ctx context.Context, db string, spec wirebson.RawDocument) (wirebson.RawDocument, int64, error)
Aggregate returns the first page of the `aggregate` cursor and the cursor ID.
func (*Pool) Collect ¶
func (p *Pool) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector.
func (*Pool) Describe ¶
func (p *Pool) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector.
func (*Pool) Find ¶
func (p *Pool) Find(ctx context.Context, db string, spec wirebson.RawDocument) (wirebson.RawDocument, int64, error)
Find returns the first page of the `find` cursor and the cursor ID.
func (*Pool) GetMore ¶
func (p *Pool) GetMore(ctx context.Context, db string, spec wirebson.RawDocument, cursorID int64) (wirebson.RawDocument, error)
GetMore returns the next page of the cursor. It is a part of the implementation of the `getMore` command.
func (*Pool) KillCursor ¶
KillCursor closes the cursor with the given id and removes it from the registry. It returns true if the cursor was found and removed. It is a part of the implementation of the `killCursors` command.
It attempts a clean close by sending the exit message to PostgreSQL. However, this could block so ctx is available to limit the time to wait (up to 3 seconds). The underlying connection will always be called regardless of any other errors.
func (*Pool) ListCollections ¶
func (p *Pool) ListCollections(ctx context.Context, db string, spec wirebson.RawDocument) (wirebson.RawDocument, int64, error)
ListCollections returns the first page of the `listCollections` cursor and the cursor ID.
func (*Pool) ListIndexes ¶
func (p *Pool) ListIndexes(ctx context.Context, db string, spec wirebson.RawDocument) (wirebson.RawDocument, int64, error)
ListIndexes returns the first page of the `listIndexes` cursor and the cursor ID.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package bsonhex provides functionality to decode BSONHEX type.
|
Package bsonhex provides functionality to decode BSONHEX type. |
|
Package cursor provides access to DocumentDB cursors.
|
Package cursor provides access to DocumentDB cursors. |
|
Package main contains code generator for DocumentDB APIs.
|
Package main contains code generator for DocumentDB APIs. |