2024-07-14 09:44:49 +00:00
|
|
|
package providers
|
|
|
|
|
|
|
|
import (
|
2024-07-14 15:58:23 +00:00
|
|
|
"leafdev.top/leaf/rag/ent"
|
2024-07-14 09:44:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func providerEnt() (*ent.Client, error) {
|
|
|
|
var config = MustGet[GlobalConfig]()
|
|
|
|
return ent.Open(
|
|
|
|
config.DB.Driver,
|
|
|
|
config.DB.DSN2,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
func init() {
|
|
|
|
Must(Container.Provide(providerEnt))
|
|
|
|
|
|
|
|
//
|
|
|
|
//if err := Ent.Schema.Create(
|
|
|
|
// context.Background(),
|
|
|
|
// migrate.WithDropIndex(true),
|
|
|
|
// migrate.WithDropColumn(true),
|
|
|
|
//); err != nil {
|
|
|
|
// Logger.Fatal("failed creating schema resources", zap.Error(err))
|
|
|
|
//}
|
|
|
|
}
|