mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 11:04:25 +00:00
b7d027e2fd
* fix(db): always use begin tx * fix(handler): timeout for begin
26 lines
383 B
Go
26 lines
383 B
Go
package view
|
|
|
|
import (
|
|
"github.com/jinzhu/gorm"
|
|
|
|
"github.com/zitadel/zitadel/internal/database"
|
|
)
|
|
|
|
type View struct {
|
|
Db *gorm.DB
|
|
}
|
|
|
|
func StartView(sqlClient *database.DB) (*View, error) {
|
|
gorm, err := gorm.Open("postgres", sqlClient.DB)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &View{
|
|
Db: gorm,
|
|
}, nil
|
|
}
|
|
|
|
func (v *View) Health() (err error) {
|
|
return v.Db.DB().Ping()
|
|
}
|