fastclient

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package fastclient provides a narrow, low-overhead client for bulk inserts into the TreeDB Mongo gateway.

It is intentionally not a general MongoDB driver. Use the official MongoDB Go driver for compatibility coverage. Use this package when the workload already has validated BSON documents and wants acknowledged insert throughput without the official driver's InsertMany _id extraction and InsertedIDs bookkeeping.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func Connect

func Connect(ctx context.Context, address string) (*Client, error)

func New

func New(conn net.Conn) *Client

func (*Client) Close

func (c *Client) Close() error

func (*Client) FindRawBSON

func (c *Client) FindRawBSON(ctx context.Context, command bson.Raw) ([]bson.Raw, error)

FindRawBSON sends a find command and returns the cursor.firstBatch documents from the response. Non-find commands are rejected because this helper only understands find-style cursor replies.

func (*Client) FindRawBSONBorrowed

func (c *Client) FindRawBSONBorrowed(ctx context.Context, command bson.Raw, fn func([]bson.Raw) error) error

FindRawBSONBorrowed is like FindRawBSON, but the returned BSON documents are borrowed and valid only for the duration of fn. The callback runs while the client mutex is held, so it must not call back into the same client and must not retain the batch or any bson.Raw after returning. It is intended for benchmark hot paths that validate a response without retaining it.

func (*Client) InsertManyRawBSON

func (c *Client) InsertManyRawBSON(ctx context.Context, database, collection string, docs []bson.Raw) (int, error)

Jump to

Keyboard shortcuts

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