MCPcopy Create free account
hub / github.com/pydio/cells / buildSocketConnectionString

Function buildSocketConnectionString

discovery/install/lib/database.go:157–179  ·  view source on GitHub ↗
(c *install.InstallConfig, values string, pg bool)

Source from the content-addressed store, hash-verified

155}
156
157func buildSocketConnectionString(c *install.InstallConfig, values string, pg bool) string {
158 if pg {
159 // leave empty host and use host=/path/to/file in query
160 u := &url.URL{}
161 u.Scheme = "postgres"
162 qv := url.Values{}
163 qv.Set("host", c.GetDbSocketFile())
164 u.RawQuery = qv.Encode()
165 u.Path = c.GetDbTCPName()
166 u.User = url.UserPassword(c.DbSocketUser, c.DbSocketPassword)
167 return u.String() + "&" + values
168
169 } else {
170 conf := mysql.NewConfig()
171 conf.User = c.GetDbSocketUser()
172 conf.Passwd = c.GetDbSocketPassword()
173 conf.Net = "unix"
174 conf.Addr = c.GetDbSocketFile()
175 conf.DBName = c.GetDbSocketName()
176 conf.ParseTime = true
177 return "mysql://" + conf.FormatDSN() + "&" + values
178 }
179}
180
181func buildSqliteConnectionString(c *install.InstallConfig, values string) string {
182 return "sqlite://" + c.GetDbSocketFile() + "?" + values

Callers 1

dsnFromInstallConfigFunction · 0.85

Calls 8

GetDbSocketFileMethod · 0.80
GetDbTCPNameMethod · 0.80
GetDbSocketUserMethod · 0.80
GetDbSocketPasswordMethod · 0.80
GetDbSocketNameMethod · 0.80
SetMethod · 0.65
EncodeMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…