(config pc.SerializedConfig)
| 23 | ) |
| 24 | |
| 25 | func 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 | |
| 56 | type postgresSQLQueries struct { |
| 57 | defaultOfflineSQLQueries |
nothing calls this directly
no test coverage detected