feat: implement new structure

This commit is contained in:
2025-12-29 09:30:49 +08:00
parent 503b15aab7
commit ad52371028
116 changed files with 17579 additions and 1213 deletions

View File

@@ -1,9 +1,99 @@
package services
import (
"go.ipao.vip/atom"
"go.ipao.vip/atom/container"
"go.ipao.vip/atom/contracts"
"go.ipao.vip/atom/opt"
"gorm.io/gorm"
)
func Provide(opts ...opt.Option) error {
if err := container.Container.Provide(func() (*common, error) {
obj := &common{}
return obj, nil
}); err != nil {
return err
}
if err := container.Container.Provide(func() (*content, error) {
obj := &content{}
return obj, nil
}); err != nil {
return err
}
if err := container.Container.Provide(func() (*creator, error) {
obj := &creator{}
return obj, nil
}); err != nil {
return err
}
if err := container.Container.Provide(func() (*order, error) {
obj := &order{}
return obj, nil
}); err != nil {
return err
}
if err := container.Container.Provide(func(
common *common,
content *content,
creator *creator,
db *gorm.DB,
order *order,
super *super,
tenant *tenant,
user *user,
wallet *wallet,
) (contracts.Initial, error) {
obj := &services{
common: common,
content: content,
creator: creator,
db: db,
order: order,
super: super,
tenant: tenant,
user: user,
wallet: wallet,
}
if err := obj.Prepare(); err != nil {
return nil, err
}
return obj, nil
}, atom.GroupInitial); err != nil {
return err
}
if err := container.Container.Provide(func() (*super, error) {
obj := &super{}
return obj, nil
}); err != nil {
return err
}
if err := container.Container.Provide(func() (*tenant, error) {
obj := &tenant{}
return obj, nil
}); err != nil {
return err
}
if err := container.Container.Provide(func() (*user, error) {
obj := &user{}
return obj, nil
}); err != nil {
return err
}
if err := container.Container.Provide(func() (*wallet, error) {
obj := &wallet{}
return obj, nil
}); err != nil {
return err
}
return nil
}