final project structure

This commit is contained in:
2025-04-15 22:36:22 +02:00
parent d6b3e88b5f
commit 284a40fac2
65 changed files with 668 additions and 447 deletions

View File

@@ -8,6 +8,7 @@ import (
"gorm.io/driver/mysql"
"gorm.io/gorm"
"gorm.io/gorm/clause"
)
var DB *gorm.DB
@@ -37,7 +38,7 @@ func Connect() error {
func Migrate() error {
var err error
err = DB.AutoMigrate(slices.Concat(
models.LogModels, models.AssetModels, models.TaxonomyModels))
log.Models, asset.Models, taxonomy.Models))
if err != nil {
return fmt.Errorf("auto migration failed: %w", err)
}
@@ -49,3 +50,7 @@ func Migrate() error {
return nil
}
func Preload() *gorm.DB {
return DB.Preload(clause.Associations)
}