mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-02 04:12:16 +00:00
* feat: get views and failed events * feat: get views and failed events * feat: get views and failed events * Update internal/view/repository/sequence.go Co-authored-by: Livio Amstutz <[email protected]> * Update internal/view/repository/general_query.go Co-authored-by: Livio Amstutz <[email protected]> Co-authored-by: Livio Amstutz <[email protected]>
26 lines
588 B
Go
26 lines
588 B
Go
package repository
|
|
|
|
import (
|
|
"database/sql"
|
|
"github.com/caos/zitadel/internal/config/types"
|
|
"github.com/caos/zitadel/internal/errors"
|
|
"github.com/jinzhu/gorm"
|
|
)
|
|
|
|
type ViewConfig struct {
|
|
SQL *types.SQL
|
|
}
|
|
|
|
func Start(conf ViewConfig) (*sql.DB, *gorm.DB, error) {
|
|
sqlClient, err := sql.Open("postgres", conf.SQL.ConnectionString())
|
|
if err != nil {
|
|
return nil, nil, errors.ThrowPreconditionFailed(err, "SQL-9qBtr", "unable to open database connection")
|
|
}
|
|
|
|
client, err := gorm.Open("postgres", sqlClient)
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
return sqlClient, client, nil
|
|
}
|