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.
44 lines
786 B
44 lines
786 B
package dao |
|
|
|
import ( |
|
"context" |
|
|
|
"go-common/app/interface/main/push/conf" |
|
"go-common/library/queue/databus" |
|
"go-common/library/stat/prom" |
|
) |
|
|
|
// Dao . |
|
type Dao struct { |
|
c *conf.Config |
|
reportPub *databus.Databus |
|
callbackPub *databus.Databus |
|
} |
|
|
|
// New creates a push-service DAO instance. |
|
func New(c *conf.Config) *Dao { |
|
d := &Dao{ |
|
c: c, |
|
reportPub: databus.New(c.ReportPub), |
|
callbackPub: databus.New(c.CallbackPub), |
|
} |
|
return d |
|
} |
|
|
|
// PromError prom error |
|
func PromError(name string) { |
|
prom.BusinessErrCount.Incr(name) |
|
} |
|
|
|
// PromInfo add prom info |
|
func PromInfo(name string) { |
|
prom.BusinessInfoCount.Incr(name) |
|
} |
|
|
|
// Close dao. |
|
func (d *Dao) Close() {} |
|
|
|
// Ping check connection status. |
|
func (d *Dao) Ping(c context.Context) (err error) { |
|
return |
|
}
|
|
|