mongo

package
v0.11.644 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LimitQuery added in v0.11.644

func LimitQuery(q string, limit int64) string

LimitQuery lets `bruin query --limit N` work for MongoDB by injecting the limit into the query envelope. If the query can't be parsed it is returned as-is. Shared by the mongo and mongo_atlas connection types.

func RunQuery added in v0.11.644

func RunQuery(ctx context.Context, client *mongo.Client, defaultDatabase, queryStr string) (*query.QueryResult, error)

RunQuery executes a MongoDB query envelope against the given client and returns a tabular result. defaultDatabase is used when the envelope omits a "database". It is shared by the mongo and mongo_atlas connection types.

Types

type Config

type Config struct {
	Username string
	Password string
	Host     string
	Port     int
	Database string
}

func (*Config) GetIngestrURI

func (c *Config) GetIngestrURI() string

type DB

type DB struct {
	Name string
	// contains filtered or unexported fields
}

func NewDB

func NewDB(c *Config) (*DB, error)

func (*DB) GetIngestrURI

func (db *DB) GetIngestrURI() (string, error)

func (*DB) Limit added in v0.11.644

func (db *DB) Limit(q string, limit int64) string

func (*DB) Ping added in v0.11.644

func (db *DB) Ping(ctx context.Context) error

func (*DB) Select added in v0.11.644

func (db *DB) Select(ctx context.Context, q *query.Query) ([][]interface{}, error)

func (*DB) SelectWithSchema added in v0.11.644

func (db *DB) SelectWithSchema(ctx context.Context, q *query.Query) (*query.QueryResult, error)

type MongoConnection

type MongoConnection interface {
	GetIngestrURI() (string, error)
}

Jump to

Keyboard shortcuts

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