You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
888 B
35 lines
888 B
package main
|
|
|
|
import (
|
|
"github.com/TremblingV5/DouTok/applications/relation/dal/model"
|
|
"github.com/TremblingV5/DouTok/pkg/dtviper"
|
|
"github.com/TremblingV5/DouTok/pkg/mysqlIniter"
|
|
"gorm.io/gen"
|
|
)
|
|
|
|
func main() {
|
|
g := gen.NewGenerator(gen.Config{
|
|
OutPath: "./applications/relation/dal/query",
|
|
Mode: gen.WithoutContext | gen.WithDefaultQuery | gen.WithQueryInterface,
|
|
})
|
|
|
|
cfg := dtviper.ConfigInit("", "relation")
|
|
|
|
db, err := mysqlIniter.InitDb(
|
|
cfg.Viper.GetString("MySQL.Username"),
|
|
cfg.Viper.GetString("MySQL.Password"),
|
|
cfg.Viper.GetString("MySQL.Host"),
|
|
cfg.Viper.GetString("MySQL.Port"),
|
|
cfg.Viper.GetString("MySQL.Database"),
|
|
)
|
|
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
g.UseDB(db)
|
|
g.ApplyBasic(model.Relation{}, model.FollowCount{}, model.FollowerCount{})
|
|
g.ApplyInterface(func() {}, model.Relation{}, model.FollowCount{}, model.FollowerCount{})
|
|
|
|
g.Execute()
|
|
}
|
|
|