26 lines
437 B
Go
26 lines
437 B
Go
package graph
|
|
|
|
import (
|
|
"context"
|
|
|
|
"forge.cadoles.com/Cadoles/daddy/internal/orm"
|
|
"github.com/jinzhu/gorm"
|
|
|
|
"github.com/pkg/errors"
|
|
"gitlab.com/wpetit/goweb/middleware/container"
|
|
)
|
|
|
|
func getDB(ctx context.Context) (*gorm.DB, error) {
|
|
ctn, err := container.From(ctx)
|
|
if err != nil {
|
|
return nil, errors.WithStack(err)
|
|
}
|
|
|
|
orm, err := orm.From(ctn)
|
|
if err != nil {
|
|
return nil, errors.WithStack(err)
|
|
}
|
|
|
|
return orm.DB(), nil
|
|
}
|