Create & Init Project...
This commit is contained in:
28
app/job/main/archive/dao/result/dao.go
Normal file
28
app/job/main/archive/dao/result/dao.go
Normal file
@ -0,0 +1,28 @@
|
||||
package result
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go-common/app/job/main/archive/conf"
|
||||
"go-common/library/database/sql"
|
||||
)
|
||||
|
||||
// Dao is redis dao.
|
||||
type Dao struct {
|
||||
c *conf.Config
|
||||
db *sql.DB
|
||||
}
|
||||
|
||||
// New is new redis dao.
|
||||
func New(c *conf.Config) (d *Dao) {
|
||||
d = &Dao{
|
||||
c: c,
|
||||
db: sql.NewMySQL(c.DB.Result),
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
// BeginTran begin transcation.
|
||||
func (d *Dao) BeginTran(c context.Context) (tx *sql.Tx, err error) {
|
||||
return d.db.Begin(c)
|
||||
}
|
Reference in New Issue
Block a user