mirror of
https://github.com/gofiber/storage.git
synced 2025-10-05 16:48:25 +08:00
Rename Connection to ConnectionURL
This commit is contained in:
@@ -50,7 +50,7 @@ store := mongodb.New(mongodb.Config{
|
|||||||
|
|
||||||
// Initialize custom config using connection string
|
// Initialize custom config using connection string
|
||||||
store := mongodb.New(mongodb.Config{
|
store := mongodb.New(mongodb.Config{
|
||||||
Connection: "mongodb://user:password@127.0.0.1:27017",
|
ConnectionURI: "mongodb://user:password@127.0.0.1:27017",
|
||||||
Database: "fiber",
|
Database: "fiber",
|
||||||
Collection: "fiber_storage",
|
Collection: "fiber_storage",
|
||||||
Reset: false,
|
Reset: false,
|
||||||
@@ -64,7 +64,7 @@ type Config struct {
|
|||||||
// Connection string to use for DB. Will override all other authentication values if used
|
// Connection string to use for DB. Will override all other authentication values if used
|
||||||
//
|
//
|
||||||
// Optional. Default is ""
|
// Optional. Default is ""
|
||||||
Connection string
|
ConnectionURI string
|
||||||
|
|
||||||
// Host name where the DB is hosted
|
// Host name where the DB is hosted
|
||||||
//
|
//
|
||||||
@@ -106,7 +106,7 @@ type Config struct {
|
|||||||
### Default Config
|
### Default Config
|
||||||
```go
|
```go
|
||||||
var ConfigDefault = Config{
|
var ConfigDefault = Config{
|
||||||
Connection: "",
|
ConnectionURI: "",
|
||||||
Host: "127.0.0.1",
|
Host: "127.0.0.1",
|
||||||
Port: 27017,
|
Port: 27017,
|
||||||
Database: "fiber",
|
Database: "fiber",
|
||||||
|
@@ -5,7 +5,7 @@ type Config struct {
|
|||||||
// Connection string to use for DB. Will override all other authentication values if used
|
// Connection string to use for DB. Will override all other authentication values if used
|
||||||
//
|
//
|
||||||
// Optional. Default is ""
|
// Optional. Default is ""
|
||||||
Connection string
|
ConnectionURI string
|
||||||
|
|
||||||
// Host name where the DB is hosted
|
// Host name where the DB is hosted
|
||||||
//
|
//
|
||||||
@@ -45,7 +45,7 @@ type Config struct {
|
|||||||
|
|
||||||
// ConfigDefault is the default config
|
// ConfigDefault is the default config
|
||||||
var ConfigDefault = Config{
|
var ConfigDefault = Config{
|
||||||
Connection: "",
|
ConnectionURI: "",
|
||||||
Host: "127.0.0.1",
|
Host: "127.0.0.1",
|
||||||
Port: 27017,
|
Port: 27017,
|
||||||
Database: "fiber",
|
Database: "fiber",
|
||||||
|
@@ -36,8 +36,8 @@ func New(config ...Config) *Storage {
|
|||||||
var dsn string
|
var dsn string
|
||||||
|
|
||||||
// Check if user supplied connection string
|
// Check if user supplied connection string
|
||||||
if cfg.Connection != "" {
|
if cfg.ConnectionURI != "" {
|
||||||
dsn = cfg.Connection
|
dsn = cfg.ConnectionURI
|
||||||
} else {
|
} else {
|
||||||
dsn = "mongodb://"
|
dsn = "mongodb://"
|
||||||
if cfg.Username != "" {
|
if cfg.Username != "" {
|
||||||
|
Reference in New Issue
Block a user