mirror of
https://github.com/bitmagnet-io/bitmagnet.git
synced 2026-07-24 13:11:05 -04:00
24 lines
302 B
Go
24 lines
302 B
Go
package postgres
|
|
|
|
import (
|
|
"go.uber.org/fx"
|
|
"gorm.io/driver/postgres"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Params struct {
|
|
fx.In
|
|
Config Config
|
|
}
|
|
|
|
type Result struct {
|
|
fx.Out
|
|
Dialector gorm.Dialector
|
|
}
|
|
|
|
func New(p Params) (Result, error) {
|
|
return Result{
|
|
Dialector: postgres.Open(p.Config.DSN()),
|
|
}, nil
|
|
}
|