You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
310 B
20 lines
310 B
2 years ago
|
package dorm
|
||
|
|
||
|
import (
|
||
|
"github.com/beego/beego/v2/client/orm"
|
||
|
_ "github.com/lib/pq"
|
||
|
)
|
||
|
|
||
|
func NewBeegoPostgresClient(dns string) (*BeegoClient, error) {
|
||
|
|
||
|
c := &BeegoClient{}
|
||
|
|
||
|
err := orm.RegisterDataBase("default", "postgres", dns)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
c.Db = orm.NewOrm()
|
||
|
|
||
|
return c, err
|
||
|
}
|