MCPcopy
hub / github.com/sqlc-dev/sqlc / StartPostgreSQLServer

Function StartPostgreSQLServer

internal/sqltest/docker/postgres.go:16–39  ·  view source on GitHub ↗
(c context.Context)

Source from the content-addressed store, hash-verified

14var postgresHost string
15
16func StartPostgreSQLServer(c context.Context) (string, error) {
17 if err := Installed(); err != nil {
18 return "", err
19 }
20 if postgresHost != "" {
21 return postgresHost, nil
22 }
23 value, err, _ := flight.Do("postgresql", func() (interface{}, error) {
24 host, err := startPostgreSQLServer(c)
25 if err != nil {
26 return "", err
27 }
28 postgresHost = host
29 return host, err
30 })
31 if err != nil {
32 return "", err
33 }
34 data, ok := value.(string)
35 if !ok {
36 return "", fmt.Errorf("returned value was not a string")
37 }
38 return data, nil
39}
40
41func startPostgreSQLServer(c context.Context) (string, error) {
42 {

Callers 3

TestExpandPostgreSQLFunction · 0.92
TestReplayFunction · 0.92
postgreSQLFunction · 0.92

Calls 2

InstalledFunction · 0.85
startPostgreSQLServerFunction · 0.70

Tested by 2

TestExpandPostgreSQLFunction · 0.74
TestReplayFunction · 0.74