MCPcopy Create free account
hub / github.com/featureform/featureform / postgresOfflineStoreFactory

Function postgresOfflineStoreFactory

provider/postgres.go:25–54  ·  view source on GitHub ↗
(config pc.SerializedConfig)

Source from the content-addressed store, hash-verified

23)
24
25func postgresOfflineStoreFactory(config pc.SerializedConfig) (Provider, error) {
26 sc := pc.PostgresConfig{}
27 if err := sc.Deserialize(config); err != nil {
28 return nil, NewProviderError(Runtime, pt.PostgresOffline, ConfigDeserialize, err.Error())
29 }
30
31 // We are doing this to support older versions of
32 // featureform that did not have the sslmode field
33 // on the client side.
34 sslMode := sc.SSLMode
35 if sslMode == "" {
36 sslMode = "disable"
37 }
38
39 queries := postgresSQLQueries{}
40 queries.setVariableBinding(PostgresBindingStyle)
41 sgConfig := SQLOfflineStoreConfig{
42 Config: config,
43 ConnectionURL: fmt.Sprintf("postgres://%s:%s@%s:%s/%s?sslmode=%s", sc.Username, sc.Password, sc.Host, sc.Port, sc.Database, sslMode),
44 Driver: "postgres",
45 ProviderType: pt.PostgresOffline,
46 QueryImpl: &queries,
47 }
48
49 store, err := NewSQLOfflineStore(sgConfig)
50 if err != nil {
51 return nil, err
52 }
53 return store, nil
54}
55
56type postgresSQLQueries struct {
57 defaultOfflineSQLQueries

Callers

nothing calls this directly

Calls 5

DeserializeMethod · 0.95
NewProviderErrorFunction · 0.85
NewSQLOfflineStoreFunction · 0.85
setVariableBindingMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected