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.
40 lines
761 B
40 lines
761 B
2 months ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"github.com/TremblingV5/DouTok/applications/feed/dal/model"
|
||
|
"github.com/TremblingV5/DouTok/config/configStruct"
|
||
|
"github.com/TremblingV5/DouTok/pkg/configurator"
|
||
|
"github.com/TremblingV5/DouTok/pkg/mysqlIniter"
|
||
|
"gorm.io/gen"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
g := gen.NewGenerator(gen.Config{
|
||
|
OutPath: "../query",
|
||
|
Mode: gen.WithoutContext | gen.WithDefaultQuery | gen.WithQueryInterface,
|
||
|
})
|
||
|
|
||
|
var config configStruct.MySQLConfig
|
||
|
configurator.InitConfig(
|
||
|
&config, "mysql.yaml",
|
||
|
)
|
||
|
|
||
|
db, err := mysqlIniter.InitDb(
|
||
|
config.Username,
|
||
|
config.Password,
|
||
|
config.Host,
|
||
|
config.Port,
|
||
|
config.Database,
|
||
|
)
|
||
|
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
|
||
|
g.UseDB(db)
|
||
|
g.ApplyBasic(model.Video{})
|
||
|
g.ApplyInterface(func() {}, model.Video{})
|
||
|
|
||
|
g.Execute()
|
||
|
}
|