@@ -7,7 +7,8 @@ type PostgresConfig =
7
7
port: string
8
8
username: string
9
9
password: string
10
- database: string }
10
+ database: string
11
+ schema: string option }
11
12
12
13
type PoolingConfig =
13
14
{ minPoolSize: int option
@@ -50,12 +51,28 @@ module Postgres =
50
51
let private storeSettingsWithPooling ( config : PostgresConfig ) ( pooling : PoolingConfig ): string =
51
52
sprintf " %s ;%s " ( storeSettings config) ( poolingSettings pooling)
52
53
54
+ let private setSettingsSchema ( config : PostgresConfig )
55
+ ( settings : SqlStreamStore.PostgresStreamStoreSettings )
56
+ : SqlStreamStore.PostgresStreamStoreSettings =
57
+ match config.schema with
58
+ | None -> ()
59
+ | Some ( schema) -> settings.Schema <- schema
60
+
61
+ settings
62
+
53
63
let createStore ( config : PostgresConfig ): SqlStreamStore.PostgresStreamStore =
54
- new SqlStreamStore.PostgresStreamStore( SqlStreamStore.PostgresStreamStoreSettings( storeSettings config))
64
+ let settings =
65
+ SqlStreamStore.PostgresStreamStoreSettings( storeSettings config)
66
+ |> setSettingsSchema config
67
+
68
+ new SqlStreamStore.PostgresStreamStore( settings)
55
69
56
70
let createStoreWithPoolingConfig ( config : PostgresConfig ) ( pooling : PoolingConfig ): SqlStreamStore.PostgresStreamStore =
57
- new SqlStreamStore.PostgresStreamStore( SqlStreamStore.PostgresStreamStoreSettings
58
- ( storeSettingsWithPooling config pooling))
71
+ let settings =
72
+ SqlStreamStore.PostgresStreamStoreSettings( storeSettingsWithPooling config pooling)
73
+ |> setSettingsSchema config
74
+
75
+ new SqlStreamStore.PostgresStreamStore( settings)
59
76
60
77
let createStoreWithConfigString ( config : string ): SqlStreamStore.PostgresStreamStore =
61
78
new SqlStreamStore.PostgresStreamStore( SqlStreamStore.PostgresStreamStoreSettings( config))
0 commit comments