NewSQL initializes a new sql driver.
(connectionString string, namespace string)
| 281 | |
| 282 | // NewSQL initializes a new sql driver. |
| 283 | func NewSQL(connectionString string, namespace string) (*SQL, error) { |
| 284 | db, err := sqlx.Connect(postgreSQLDialect, connectionString) |
| 285 | if err != nil { |
| 286 | return nil, err |
| 287 | } |
| 288 | |
| 289 | driver := &SQL{ |
| 290 | db: db, |
| 291 | statementBuilder: sq.StatementBuilder.PlaceholderFormat(sq.Dollar), |
| 292 | } |
| 293 | |
| 294 | if err := driver.ensureDBSetup(); err != nil { |
| 295 | return nil, err |
| 296 | } |
| 297 | |
| 298 | driver.namespace = namespace |
| 299 | driver.SetLogger(slog.Default().Handler()) |
| 300 | |
| 301 | return driver, nil |
| 302 | } |
| 303 | |
| 304 | // Get returns the release named by key. |
| 305 | func (s *SQL) Get(key string) (release.Releaser, error) { |
no test coverage detected
searching dependent graphs…