mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-17 13:27:34 +00:00
fa9f581d56
* chore: move to new org * logging * fix: org rename caos -> zitadel Co-authored-by: adlerhurst <silvan.reusser@gmail.com>
33 lines
605 B
Go
33 lines
605 B
Go
package view
|
|
|
|
import (
|
|
"database/sql"
|
|
|
|
"github.com/zitadel/zitadel/internal/id"
|
|
"github.com/zitadel/zitadel/internal/query"
|
|
|
|
"github.com/jinzhu/gorm"
|
|
)
|
|
|
|
type View struct {
|
|
Db *gorm.DB
|
|
Query *query.Queries
|
|
idGenerator id.Generator
|
|
}
|
|
|
|
func StartView(sqlClient *sql.DB, idGenerator id.Generator, queries *query.Queries) (*View, error) {
|
|
gorm, err := gorm.Open("postgres", sqlClient)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &View{
|
|
Db: gorm,
|
|
idGenerator: idGenerator,
|
|
Query: queries,
|
|
}, nil
|
|
}
|
|
|
|
func (v *View) Health() (err error) {
|
|
return v.Db.DB().Ping()
|
|
}
|