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.
dorm/xorm_postgres.go

22 lines
369 B

package dorm
import (
"errors"
"fmt"
_ "github.com/lib/pq"
"xorm.io/xorm"
)
func NewXormPostgresClient(config *XormClientConfigXorm) (*XormClient, error) {
var err error
c := &XormClient{config: config}
c.Db, err = xorm.NewEngine("postgres", c.config.Dns)
if err != nil {
return nil, errors.New(fmt.Sprintf("连接失败:%v", err))
}
return c, nil
}