// BuildConnString creates a database connection string based on configuration parameters.
BuildConnString creates a database connection string based on configuration parameters.
// BuildConnString creates a database connection string based on configuration parameters .
func BuildConnString(c *config.Database) string {
	if c.Dsn != "" {
		return c.Dsn
	}
	if c.Name == "" {
		return ""
	}
	vv := url.Values{}
	var userInfo *url.Userinfo
	if c.User != "" {
		if c.Password == "" {
			userInfo = url.User(c.User)
		} else {
			userInfo = url.UserPassword(c.User, c.Password)
		}
	}
	u := url.URL{
		Scheme:   "mongodb",
		Path:     c.Name,
		Host:     c.Host,
		User:     userInfo,
		RawQuery: vv.Encode(),
	}
	return u.String()
}
func BuildConnString ( c * config . Database ) string { if c . Dsn != " " { return c . Dsn } if c . Name == " " { return " " } vv := url . Values { } var userInfo * url . Userinfo if c . User != " " { if c . Password == " " { userInfo = url . User ( c . User ) } else { userInfo = url . UserPassword ( c . User , c . Password ) } } u := url . URL { Scheme : " " , Path : c . Name , Host : c . Host , User : userInfo , RawQuery : vv . Encode ( ) , } return u . String ( ) }
BuildConnString creates a database connection string based on configuration parameters.
BuildConnString creates a database connection string based on configuration parameters .