feat: 完善后端脚手架基础能力
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"ariga.io/atlas-provider-gorm/gormschema"
|
||||
|
||||
"skeleton/models"
|
||||
)
|
||||
|
||||
func main() {
|
||||
dialect := flag.String("dialect", "postgres", "database dialect: postgres, mysql, sqlite")
|
||||
flag.Parse()
|
||||
|
||||
stmts, err := gormschema.New(*dialect).Load(
|
||||
&models.User{},
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to load gorm schema: %v", err)
|
||||
}
|
||||
_, _ = io.WriteString(os.Stdout, stmts)
|
||||
}
|
||||
Reference in New Issue
Block a user