axonhub / internal /server /dependencies /fx_module.go
llzai's picture
Upload 1793 files
9853396 verified
package dependencies
import (
"context"
"github.com/zhenzou/executors"
"go.uber.org/fx"
"github.com/looplj/axonhub/internal/log"
"github.com/looplj/axonhub/internal/server/db"
"github.com/looplj/axonhub/llm/httpclient"
)
var Module = fx.Module("dependencies",
fx.Provide(log.New),
fx.Provide(db.NewEntClient),
fx.Provide(httpclient.NewHttpClient),
fx.Provide(NewExecutors),
fx.Invoke(func(lc fx.Lifecycle, executor executors.ScheduledExecutor) {
lc.Append(fx.Hook{
OnStop: func(ctx context.Context) error {
return executor.Shutdown(ctx)
},
})
}),
)