feat: complete charge

This commit is contained in:
Rogee
2024-12-10 14:50:50 +08:00
parent e3ef31037c
commit db0eacbc46
12 changed files with 431 additions and 64 deletions

View File

@@ -7,14 +7,17 @@ import (
"git.ipao.vip/rogeecn/atom/container"
"git.ipao.vip/rogeecn/atom/contracts"
"git.ipao.vip/rogeecn/atom/utils/opt"
hashids "github.com/speps/go-hashids/v2"
)
func Provide(opts ...opt.Option) error {
if err := container.Container.Provide(func(
hashIds *hashids.HashID,
svc *Service,
) (*Controller, error) {
obj := &Controller{
svc: svc,
hashIds: hashIds,
svc: svc,
}
return obj, nil
}); err != nil {
@@ -37,9 +40,11 @@ func Provide(opts ...opt.Option) error {
if err := container.Container.Provide(func(
db *sql.DB,
hashIds *hashids.HashID,
) (*Service, error) {
obj := &Service{
db: db,
db: db,
hashIds: hashIds,
}
if err := obj.Prepare(); err != nil {
return nil, err