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 ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) FindRawBSON(ctx context.Context, command bson.Raw) ([]bson.Raw, error)
- func (c *Client) FindRawBSONBorrowed(ctx context.Context, command bson.Raw, fn func([]bson.Raw) error) error
- func (c *Client) InsertManyRawBSON(ctx context.Context, database, collection string, docs []bson.Raw) (int, error)
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 (*Client) FindRawBSON ¶
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.