leaf-library-3/internal/base/app.go
2024-12-06 23:38:22 +08:00

58 lines
1.4 KiB
Go

package base
import (
"github.com/milvus-io/milvus-sdk-go/v2/client"
"gorm.io/gorm"
"leafdev.top/Leaf/leaf-library-3/internal/api"
"leafdev.top/Leaf/leaf-library-3/internal/base/conf"
"leafdev.top/Leaf/leaf-library-3/internal/base/logger"
"leafdev.top/Leaf/leaf-library-3/internal/base/redis"
"leafdev.top/Leaf/leaf-library-3/internal/base/s3"
"leafdev.top/Leaf/leaf-library-3/internal/base/server"
"leafdev.top/Leaf/leaf-library-3/internal/batch"
"leafdev.top/Leaf/leaf-library-3/internal/dao"
"leafdev.top/Leaf/leaf-library-3/internal/services"
)
type Application struct {
Config *conf.Config
Logger *logger.Logger
Api *api.Api
HttpServer *server.HttpServer
GORM *gorm.DB
DAO *dao.Query
Service *services.Service
Redis *redis.Redis
Batch *batch.Batch
S3 *s3.S3
Milvus client.Client
}
func NewApplication(
config *conf.Config,
httpServer *server.HttpServer,
api *api.Api,
logger *logger.Logger,
services *services.Service,
redis *redis.Redis,
batch *batch.Batch,
s3 *s3.S3,
gorm *gorm.DB,
dao *dao.Query,
milvus client.Client,
) *Application {
return &Application{
Config: config,
HttpServer: httpServer,
Api: api,
Logger: logger,
Service: services,
Redis: redis,
Batch: batch,
S3: s3,
GORM: gorm,
DAO: dao,
Milvus: milvus,
}
}