@vira-ui/cli 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +454 -1029
  2. package/dist/go/appYaml.js +30 -30
  3. package/dist/go/backendEnvExample.js +17 -17
  4. package/dist/go/backendReadme.js +14 -14
  5. package/dist/go/channelHelpers.js +25 -25
  6. package/dist/go/configGo.js +258 -258
  7. package/dist/go/dbGo.js +43 -43
  8. package/dist/go/dbYaml.js +7 -7
  9. package/dist/go/dockerCompose.js +48 -48
  10. package/dist/go/dockerComposeProd.js +78 -78
  11. package/dist/go/dockerfile.js +15 -15
  12. package/dist/go/eventHandlerTemplate.js +22 -22
  13. package/dist/go/eventsAPI.js +411 -411
  14. package/dist/go/goMod.js +16 -16
  15. package/dist/go/kafkaGo.js +67 -67
  16. package/dist/go/kafkaYaml.js +6 -6
  17. package/dist/go/kanbanHandlers.js +216 -216
  18. package/dist/go/mainGo.js +558 -558
  19. package/dist/go/readme.js +27 -27
  20. package/dist/go/redisGo.js +31 -31
  21. package/dist/go/redisYaml.js +4 -4
  22. package/dist/go/registryGo.js +38 -38
  23. package/dist/go/sqlcYaml.js +13 -13
  24. package/dist/go/stateStore.js +115 -115
  25. package/dist/go/typesGo.js +11 -11
  26. package/dist/index.js +472 -24
  27. package/dist/react/envExample.js +3 -3
  28. package/dist/react/envLocal.js +1 -1
  29. package/dist/react/indexCss.js +17 -17
  30. package/dist/react/indexHtml.js +12 -12
  31. package/dist/react/kanbanAppTsx.js +29 -29
  32. package/dist/react/kanbanBoard.js +58 -58
  33. package/dist/react/kanbanCard.js +60 -60
  34. package/dist/react/kanbanColumn.js +62 -62
  35. package/dist/react/kanbanModels.js +32 -32
  36. package/dist/react/mainTsx.js +12 -12
  37. package/dist/react/viteConfig.js +27 -27
  38. package/package.json +47 -45
  39. package/dist/go/useViraState.js +0 -160
  40. package/dist/go/useViraStream.js +0 -167
@@ -1,262 +1,262 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.configGo = void 0;
4
- exports.configGo = `package config
5
-
6
- import (
7
- "fmt"
8
- "os"
9
- "strings"
10
-
11
- "github.com/rs/zerolog"
12
- "gopkg.in/yaml.v3"
13
- )
14
-
15
- type Config struct {
16
- Service string \`yaml:"service"\`
17
- Env string \`yaml:"env"\`
18
- HTTP struct {
19
- Port int \`yaml:"port"\`
20
- } \`yaml:"http"\`
21
- Logging struct {
22
- Level string \`yaml:"level"\`
23
- } \`yaml:"logging"\`
24
- DB struct {
25
- Host string \`yaml:"host"\`
26
- Port int \`yaml:"port"\`
27
- User string \`yaml:"user"\`
28
- Password string \`yaml:"password"\`
29
- Database string \`yaml:"database"\`
30
- SSLMode string \`yaml:"sslmode"\`
31
- } \`yaml:"db"\`
32
- Kafka struct {
33
- Brokers []string \`yaml:"brokers"\`
34
- GroupID string \`yaml:"groupId"\`
35
- Topics struct {
36
- Events string \`yaml:"events"\`
37
- DLQ string \`yaml:"dlq"\`
38
- } \`yaml:"topics"\`
39
- } \`yaml:"kafka"\`
40
- Redis struct {
41
- Host string \`yaml:"host"\`
42
- Port int \`yaml:"port"\`
43
- Password string \`yaml:"password"\`
44
- DB int \`yaml:"db"\`
45
- } \`yaml:"redis"\`
46
- Auth struct {
47
- Token string \`yaml:"token"\`
48
- } \`yaml:"auth"\`
49
- State struct {
50
- DiffMode string \`yaml:"diffMode"\`
51
- MaxHistory int \`yaml:"maxHistory"\`
52
- Persist string \`yaml:"persist"\`
53
- TTLSec int \`yaml:"ttlSeconds"\`
54
- } \`yaml:"state"\`
55
- }
56
-
57
- func Load(path string) Config {
58
- var cfg Config
59
- data, err := os.ReadFile(path)
60
- if err != nil {
61
- panic(err)
62
- }
63
- if err := yaml.Unmarshal(data, &cfg); err != nil {
64
- panic(err)
65
- }
66
-
67
- overrideEnv(&cfg)
68
- applyDefaults(&cfg)
69
- return cfg
70
- }
71
-
72
- func NewLogger(cfg Config) zerolog.Logger {
73
- level := parseLevel(cfg.Logging.Level)
74
- return zerolog.New(os.Stdout).
75
- Level(level).
76
- With().
77
- Timestamp().
78
- Str("service", cfg.Service).
79
- Str("env", cfg.Env).
80
- Logger()
81
- }
82
-
83
- func overrideEnv(cfg *Config) {
84
- if port := os.Getenv("PORT"); port != "" {
85
- if p := parsePort(port); p > 0 {
86
- cfg.HTTP.Port = p
87
- }
88
- }
89
- if lvl := os.Getenv("LOG_LEVEL"); lvl != "" {
90
- cfg.Logging.Level = lvl
91
- }
92
- if host := os.Getenv("DB_HOST"); host != "" {
93
- cfg.DB.Host = host
94
- }
95
- if port := os.Getenv("DB_PORT"); port != "" {
96
- if p := parsePort(port); p > 0 {
97
- cfg.DB.Port = p
98
- }
99
- }
100
- if user := os.Getenv("DB_USER"); user != "" {
101
- cfg.DB.User = user
102
- }
103
- if pass := os.Getenv("DB_PASSWORD"); pass != "" {
104
- cfg.DB.Password = pass
105
- }
106
- if db := os.Getenv("DB_NAME"); db != "" {
107
- cfg.DB.Database = db
108
- }
109
- if ssl := os.Getenv("DB_SSLMODE"); ssl != "" {
110
- cfg.DB.SSLMode = ssl
111
- }
112
- if brokers := os.Getenv("KAFKA_BROKERS"); brokers != "" {
113
- cfg.Kafka.Brokers = splitAndTrim(brokers)
114
- }
115
- if group := os.Getenv("KAFKA_GROUP_ID"); group != "" {
116
- cfg.Kafka.GroupID = group
117
- }
118
- if events := os.Getenv("KAFKA_TOPIC_EVENTS"); events != "" {
119
- cfg.Kafka.Topics.Events = events
120
- }
121
- if dlq := os.Getenv("KAFKA_TOPIC_DLQ"); dlq != "" {
122
- cfg.Kafka.Topics.DLQ = dlq
123
- }
124
- if host := os.Getenv("REDIS_HOST"); host != "" {
125
- cfg.Redis.Host = host
126
- }
127
- if port := os.Getenv("REDIS_PORT"); port != "" {
128
- if p := parsePort(port); p > 0 {
129
- cfg.Redis.Port = p
130
- }
131
- }
132
- if pass := os.Getenv("REDIS_PASSWORD"); pass != "" {
133
- cfg.Redis.Password = pass
134
- }
135
- if db := os.Getenv("REDIS_DB"); db != "" {
136
- if p := parsePort(db); p >= 0 {
137
- cfg.Redis.DB = p
138
- }
139
- }
140
- if diff := os.Getenv("DIFF_MODE"); diff != "" {
141
- cfg.State.DiffMode = diff
142
- }
143
- if hist := os.Getenv("DIFF_MAX_HISTORY"); hist != "" {
144
- if p := parsePort(hist); p > 0 {
145
- cfg.State.MaxHistory = p
146
- }
147
- }
148
- if p := os.Getenv("STATE_PERSIST"); p != "" {
149
- cfg.State.Persist = p
150
- }
151
- if ttl := os.Getenv("STATE_TTL_SECONDS"); ttl != "" {
152
- if p := parsePort(ttl); p >= 0 {
153
- cfg.State.TTLSec = p
154
- }
155
- }
156
- }
157
-
158
- func applyDefaults(cfg *Config) {
159
- if cfg.HTTP.Port == 0 {
160
- cfg.HTTP.Port = 8080
161
- }
162
- if cfg.Service == "" {
163
- cfg.Service = "vira-engine"
164
- }
165
- if cfg.Env == "" {
166
- cfg.Env = "development"
167
- }
168
- if cfg.Logging.Level == "" {
169
- cfg.Logging.Level = "info"
170
- }
171
- if cfg.DB.Port == 0 {
172
- cfg.DB.Port = 5432
173
- }
174
- if cfg.DB.Host == "" {
175
- cfg.DB.Host = "localhost"
176
- }
177
- if cfg.DB.User == "" {
178
- cfg.DB.User = "vira"
179
- }
180
- if cfg.DB.Password == "" {
181
- cfg.DB.Password = "vira"
182
- }
183
- if cfg.DB.Database == "" {
184
- cfg.DB.Database = "vira"
185
- }
186
- if cfg.DB.SSLMode == "" {
187
- cfg.DB.SSLMode = "disable"
188
- }
189
- if len(cfg.Kafka.Brokers) == 0 {
190
- cfg.Kafka.Brokers = []string{"localhost:9092"}
191
- }
192
- if cfg.Kafka.GroupID == "" {
193
- cfg.Kafka.GroupID = "vira-engine"
194
- }
195
- if cfg.Kafka.Topics.Events == "" {
196
- cfg.Kafka.Topics.Events = "vira.events"
197
- }
198
- if cfg.Kafka.Topics.DLQ == "" {
199
- cfg.Kafka.Topics.DLQ = "vira.events.dlq"
200
- }
201
- if cfg.Redis.Port == 0 {
202
- cfg.Redis.Port = 6379
203
- }
204
- if cfg.Redis.Host == "" {
205
- cfg.Redis.Host = "localhost"
206
- }
207
- if cfg.Redis.DB < 0 {
208
- cfg.Redis.DB = 0
209
- }
210
- if token := os.Getenv("AUTH_TOKEN"); token != "" {
211
- cfg.Auth.Token = token
212
- }
213
- if cfg.State.DiffMode == "" {
214
- cfg.State.DiffMode = "merge" // merge | patch
215
- }
216
- if cfg.State.MaxHistory == 0 {
217
- cfg.State.MaxHistory = 100
218
- }
219
- if cfg.State.Persist == "" {
220
- cfg.State.Persist = "memory" // memory | redis
221
- }
222
- if cfg.State.TTLSec < 0 {
223
- cfg.State.TTLSec = 0
224
- }
225
- }
226
-
227
- func parseLevel(lvl string) zerolog.Level {
228
- switch lvl {
229
- case "debug":
230
- return zerolog.DebugLevel
231
- case "warn":
232
- return zerolog.WarnLevel
233
- case "error":
234
- return zerolog.ErrorLevel
235
- case "fatal":
236
- return zerolog.FatalLevel
237
- default:
238
- return zerolog.InfoLevel
239
- }
240
- }
241
-
242
- func parsePort(val string) int {
243
- var p int
244
- _, err := fmt.Sscanf(val, "%d", &p)
245
- if err != nil {
246
- return 0
247
- }
248
- return p
249
- }
250
-
251
- func splitAndTrim(val string) []string {
252
- parts := strings.Split(val, ",")
253
- out := make([]string, 0, len(parts))
254
- for _, p := range parts {
255
- t := strings.TrimSpace(p)
256
- if t != "" {
257
- out = append(out, t)
258
- }
259
- }
260
- return out
261
- }
4
+ exports.configGo = `package config
5
+
6
+ import (
7
+ "fmt"
8
+ "os"
9
+ "strings"
10
+
11
+ "github.com/rs/zerolog"
12
+ "gopkg.in/yaml.v3"
13
+ )
14
+
15
+ type Config struct {
16
+ Service string \`yaml:"service"\`
17
+ Env string \`yaml:"env"\`
18
+ HTTP struct {
19
+ Port int \`yaml:"port"\`
20
+ } \`yaml:"http"\`
21
+ Logging struct {
22
+ Level string \`yaml:"level"\`
23
+ } \`yaml:"logging"\`
24
+ DB struct {
25
+ Host string \`yaml:"host"\`
26
+ Port int \`yaml:"port"\`
27
+ User string \`yaml:"user"\`
28
+ Password string \`yaml:"password"\`
29
+ Database string \`yaml:"database"\`
30
+ SSLMode string \`yaml:"sslmode"\`
31
+ } \`yaml:"db"\`
32
+ Kafka struct {
33
+ Brokers []string \`yaml:"brokers"\`
34
+ GroupID string \`yaml:"groupId"\`
35
+ Topics struct {
36
+ Events string \`yaml:"events"\`
37
+ DLQ string \`yaml:"dlq"\`
38
+ } \`yaml:"topics"\`
39
+ } \`yaml:"kafka"\`
40
+ Redis struct {
41
+ Host string \`yaml:"host"\`
42
+ Port int \`yaml:"port"\`
43
+ Password string \`yaml:"password"\`
44
+ DB int \`yaml:"db"\`
45
+ } \`yaml:"redis"\`
46
+ Auth struct {
47
+ Token string \`yaml:"token"\`
48
+ } \`yaml:"auth"\`
49
+ State struct {
50
+ DiffMode string \`yaml:"diffMode"\`
51
+ MaxHistory int \`yaml:"maxHistory"\`
52
+ Persist string \`yaml:"persist"\`
53
+ TTLSec int \`yaml:"ttlSeconds"\`
54
+ } \`yaml:"state"\`
55
+ }
56
+
57
+ func Load(path string) Config {
58
+ var cfg Config
59
+ data, err := os.ReadFile(path)
60
+ if err != nil {
61
+ panic(err)
62
+ }
63
+ if err := yaml.Unmarshal(data, &cfg); err != nil {
64
+ panic(err)
65
+ }
66
+
67
+ overrideEnv(&cfg)
68
+ applyDefaults(&cfg)
69
+ return cfg
70
+ }
71
+
72
+ func NewLogger(cfg Config) zerolog.Logger {
73
+ level := parseLevel(cfg.Logging.Level)
74
+ return zerolog.New(os.Stdout).
75
+ Level(level).
76
+ With().
77
+ Timestamp().
78
+ Str("service", cfg.Service).
79
+ Str("env", cfg.Env).
80
+ Logger()
81
+ }
82
+
83
+ func overrideEnv(cfg *Config) {
84
+ if port := os.Getenv("PORT"); port != "" {
85
+ if p := parsePort(port); p > 0 {
86
+ cfg.HTTP.Port = p
87
+ }
88
+ }
89
+ if lvl := os.Getenv("LOG_LEVEL"); lvl != "" {
90
+ cfg.Logging.Level = lvl
91
+ }
92
+ if host := os.Getenv("DB_HOST"); host != "" {
93
+ cfg.DB.Host = host
94
+ }
95
+ if port := os.Getenv("DB_PORT"); port != "" {
96
+ if p := parsePort(port); p > 0 {
97
+ cfg.DB.Port = p
98
+ }
99
+ }
100
+ if user := os.Getenv("DB_USER"); user != "" {
101
+ cfg.DB.User = user
102
+ }
103
+ if pass := os.Getenv("DB_PASSWORD"); pass != "" {
104
+ cfg.DB.Password = pass
105
+ }
106
+ if db := os.Getenv("DB_NAME"); db != "" {
107
+ cfg.DB.Database = db
108
+ }
109
+ if ssl := os.Getenv("DB_SSLMODE"); ssl != "" {
110
+ cfg.DB.SSLMode = ssl
111
+ }
112
+ if brokers := os.Getenv("KAFKA_BROKERS"); brokers != "" {
113
+ cfg.Kafka.Brokers = splitAndTrim(brokers)
114
+ }
115
+ if group := os.Getenv("KAFKA_GROUP_ID"); group != "" {
116
+ cfg.Kafka.GroupID = group
117
+ }
118
+ if events := os.Getenv("KAFKA_TOPIC_EVENTS"); events != "" {
119
+ cfg.Kafka.Topics.Events = events
120
+ }
121
+ if dlq := os.Getenv("KAFKA_TOPIC_DLQ"); dlq != "" {
122
+ cfg.Kafka.Topics.DLQ = dlq
123
+ }
124
+ if host := os.Getenv("REDIS_HOST"); host != "" {
125
+ cfg.Redis.Host = host
126
+ }
127
+ if port := os.Getenv("REDIS_PORT"); port != "" {
128
+ if p := parsePort(port); p > 0 {
129
+ cfg.Redis.Port = p
130
+ }
131
+ }
132
+ if pass := os.Getenv("REDIS_PASSWORD"); pass != "" {
133
+ cfg.Redis.Password = pass
134
+ }
135
+ if db := os.Getenv("REDIS_DB"); db != "" {
136
+ if p := parsePort(db); p >= 0 {
137
+ cfg.Redis.DB = p
138
+ }
139
+ }
140
+ if diff := os.Getenv("DIFF_MODE"); diff != "" {
141
+ cfg.State.DiffMode = diff
142
+ }
143
+ if hist := os.Getenv("DIFF_MAX_HISTORY"); hist != "" {
144
+ if p := parsePort(hist); p > 0 {
145
+ cfg.State.MaxHistory = p
146
+ }
147
+ }
148
+ if p := os.Getenv("STATE_PERSIST"); p != "" {
149
+ cfg.State.Persist = p
150
+ }
151
+ if ttl := os.Getenv("STATE_TTL_SECONDS"); ttl != "" {
152
+ if p := parsePort(ttl); p >= 0 {
153
+ cfg.State.TTLSec = p
154
+ }
155
+ }
156
+ }
157
+
158
+ func applyDefaults(cfg *Config) {
159
+ if cfg.HTTP.Port == 0 {
160
+ cfg.HTTP.Port = 8080
161
+ }
162
+ if cfg.Service == "" {
163
+ cfg.Service = "vira-engine"
164
+ }
165
+ if cfg.Env == "" {
166
+ cfg.Env = "development"
167
+ }
168
+ if cfg.Logging.Level == "" {
169
+ cfg.Logging.Level = "info"
170
+ }
171
+ if cfg.DB.Port == 0 {
172
+ cfg.DB.Port = 5432
173
+ }
174
+ if cfg.DB.Host == "" {
175
+ cfg.DB.Host = "localhost"
176
+ }
177
+ if cfg.DB.User == "" {
178
+ cfg.DB.User = "vira"
179
+ }
180
+ if cfg.DB.Password == "" {
181
+ cfg.DB.Password = "vira"
182
+ }
183
+ if cfg.DB.Database == "" {
184
+ cfg.DB.Database = "vira"
185
+ }
186
+ if cfg.DB.SSLMode == "" {
187
+ cfg.DB.SSLMode = "disable"
188
+ }
189
+ if len(cfg.Kafka.Brokers) == 0 {
190
+ cfg.Kafka.Brokers = []string{"localhost:9092"}
191
+ }
192
+ if cfg.Kafka.GroupID == "" {
193
+ cfg.Kafka.GroupID = "vira-engine"
194
+ }
195
+ if cfg.Kafka.Topics.Events == "" {
196
+ cfg.Kafka.Topics.Events = "vira.events"
197
+ }
198
+ if cfg.Kafka.Topics.DLQ == "" {
199
+ cfg.Kafka.Topics.DLQ = "vira.events.dlq"
200
+ }
201
+ if cfg.Redis.Port == 0 {
202
+ cfg.Redis.Port = 6379
203
+ }
204
+ if cfg.Redis.Host == "" {
205
+ cfg.Redis.Host = "localhost"
206
+ }
207
+ if cfg.Redis.DB < 0 {
208
+ cfg.Redis.DB = 0
209
+ }
210
+ if token := os.Getenv("AUTH_TOKEN"); token != "" {
211
+ cfg.Auth.Token = token
212
+ }
213
+ if cfg.State.DiffMode == "" {
214
+ cfg.State.DiffMode = "merge" // merge | patch
215
+ }
216
+ if cfg.State.MaxHistory == 0 {
217
+ cfg.State.MaxHistory = 100
218
+ }
219
+ if cfg.State.Persist == "" {
220
+ cfg.State.Persist = "memory" // memory | redis
221
+ }
222
+ if cfg.State.TTLSec < 0 {
223
+ cfg.State.TTLSec = 0
224
+ }
225
+ }
226
+
227
+ func parseLevel(lvl string) zerolog.Level {
228
+ switch lvl {
229
+ case "debug":
230
+ return zerolog.DebugLevel
231
+ case "warn":
232
+ return zerolog.WarnLevel
233
+ case "error":
234
+ return zerolog.ErrorLevel
235
+ case "fatal":
236
+ return zerolog.FatalLevel
237
+ default:
238
+ return zerolog.InfoLevel
239
+ }
240
+ }
241
+
242
+ func parsePort(val string) int {
243
+ var p int
244
+ _, err := fmt.Sscanf(val, "%d", &p)
245
+ if err != nil {
246
+ return 0
247
+ }
248
+ return p
249
+ }
250
+
251
+ func splitAndTrim(val string) []string {
252
+ parts := strings.Split(val, ",")
253
+ out := make([]string, 0, len(parts))
254
+ for _, p := range parts {
255
+ t := strings.TrimSpace(p)
256
+ if t != "" {
257
+ out = append(out, t)
258
+ }
259
+ }
260
+ return out
261
+ }
262
262
  `;
package/dist/go/dbGo.js CHANGED
@@ -1,47 +1,47 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dbGo = void 0;
4
- exports.dbGo = `package db
5
-
6
- import (
7
- "context"
8
- "fmt"
9
- "time"
10
-
11
- "github.com/jackc/pgx/v5/pgxpool"
12
- "github.com/rs/zerolog"
13
-
14
- "vira-engine-backend/internal/config"
15
- )
16
-
17
- func NewPool(ctx context.Context, cfg config.Config, logger zerolog.Logger) (*pgxpool.Pool, error) {
18
- dsn := fmt.Sprintf("postgres://%s:%s@%s:%d/%s?sslmode=%s",
19
- cfg.DB.User,
20
- cfg.DB.Password,
21
- cfg.DB.Host,
22
- cfg.DB.Port,
23
- cfg.DB.Database,
24
- cfg.DB.SSLMode,
25
- )
26
-
27
- poolConfig, err := pgxpool.ParseConfig(dsn)
28
- if err != nil {
29
- return nil, fmt.Errorf("parse pool config: %w", err)
30
- }
31
- poolConfig.MaxConnLifetime = time.Hour
32
- poolConfig.MaxConnIdleTime = 30 * time.Minute
33
- poolConfig.HealthCheckPeriod = 30 * time.Second
34
-
35
- pool, err := pgxpool.NewWithConfig(ctx, poolConfig)
36
- if err != nil {
37
- return nil, fmt.Errorf("create pool: %w", err)
38
- }
39
-
40
- if err := pool.Ping(ctx); err != nil {
41
- return nil, fmt.Errorf("ping db: %w", err)
42
- }
43
-
44
- logger.Info().Str("db.host", cfg.DB.Host).Int("db.port", cfg.DB.Port).Msg("db pool ready")
45
- return pool, nil
46
- }
4
+ exports.dbGo = `package db
5
+
6
+ import (
7
+ "context"
8
+ "fmt"
9
+ "time"
10
+
11
+ "github.com/jackc/pgx/v5/pgxpool"
12
+ "github.com/rs/zerolog"
13
+
14
+ "vira-engine-backend/internal/config"
15
+ )
16
+
17
+ func NewPool(ctx context.Context, cfg config.Config, logger zerolog.Logger) (*pgxpool.Pool, error) {
18
+ dsn := fmt.Sprintf("postgres://%s:%s@%s:%d/%s?sslmode=%s",
19
+ cfg.DB.User,
20
+ cfg.DB.Password,
21
+ cfg.DB.Host,
22
+ cfg.DB.Port,
23
+ cfg.DB.Database,
24
+ cfg.DB.SSLMode,
25
+ )
26
+
27
+ poolConfig, err := pgxpool.ParseConfig(dsn)
28
+ if err != nil {
29
+ return nil, fmt.Errorf("parse pool config: %w", err)
30
+ }
31
+ poolConfig.MaxConnLifetime = time.Hour
32
+ poolConfig.MaxConnIdleTime = 30 * time.Minute
33
+ poolConfig.HealthCheckPeriod = 30 * time.Second
34
+
35
+ pool, err := pgxpool.NewWithConfig(ctx, poolConfig)
36
+ if err != nil {
37
+ return nil, fmt.Errorf("create pool: %w", err)
38
+ }
39
+
40
+ if err := pool.Ping(ctx); err != nil {
41
+ return nil, fmt.Errorf("ping db: %w", err)
42
+ }
43
+
44
+ logger.Info().Str("db.host", cfg.DB.Host).Int("db.port", cfg.DB.Port).Msg("db pool ready")
45
+ return pool, nil
46
+ }
47
47
  `;
package/dist/go/dbYaml.js CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dbYaml = void 0;
4
- exports.dbYaml = `driver: postgres
5
- host: localhost
6
- port: 5432
7
- user: vira
8
- password: vira
9
- database: vira
10
- sslmode: disable
4
+ exports.dbYaml = `driver: postgres
5
+ host: localhost
6
+ port: 5432
7
+ user: vira
8
+ password: vira
9
+ database: vira
10
+ sslmode: disable
11
11
  `;