// New returns a new DB instance.
New returns a new DB instance.
// New returns a new DB instance .
func New(opt *Option) (*DB, error) {
	var entOptions []ent.Option
	if opt.Debug {
		entOptions = append(entOptions, ent.Debug())
	}
	db := &DB{}
	client, err := ent.Open(opt.Driver, opt.Dns, entOptions...)
	if err != nil {
		return nil, err
	}
	db.client = client
	return db, nil
}
func New ( opt * Option ) ( * DB , error ) { var entOptions [ ] ent . Option if opt . Debug { entOptions = append ( entOptions , ent . Debug ( ) ) } db := & DB { } client , err := ent . Open ( opt . Driver , opt . Dns , entOptions ... ) if err != nil { return nil , err } db . client = client return db , nil }
New returns a new DB instance.
New returns a new DB instance .