Documentation
¶
Overview ¶
Package ferretdb provides embeddable FerretDB implementation.
Example ¶
f, err := New(&Config{
Handler: "pg",
PostgreSQLURL: "postgres://postgres@127.0.0.1:5432/ferretdb",
})
if err != nil {
log.Fatal(err)
}
go f.Run(context.Background())
uri := f.MongoDBURI()
fmt.Println(uri)
// Use MongoDB URI as usual. For example:
//
// import "go.mongodb.org/mongo-driver/mongo"
//
// [...]
//
// mongo.Connect(ctx, options.Client().ApplyURI(uri)
Output: mongodb://127.0.0.1:27017/
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Handler to use; one of `pg` or `tigris` (if enabled at compile-time).
Handler string
// PostgreSQL connection string for `pg` handler.
PostgreSQLURL string
// Tigris connection string for `tigris` handler.
TigrisURL string
}
Config represents FerretDB configuration.
type FerretDB ¶
type FerretDB struct {
// contains filtered or unexported fields
}
FerretDB represents an instance of embeddable FerretDB implementation.
func (*FerretDB) MongoDBURI ¶
MongoDBURI returns MongoDB URI for this FerretDB instance.
Click to show internal directories.
Click to hide internal directories.