package json import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db" type Folder struct { Name string `json:"name"` Sorting string `json:"sorting"` Color string `json:"color,omitempty"` Packs []string `json:"packs"` Folders []*Folder `json:"folders,omitempty"` } func (f *Folder) ToDB(dest **db.Folder) bool { if dest == nil { return false } folder := &db.Folder{ Name: f.Name, Sorting: f.Sorting, Color: f.Color, } copy(folder.Packs, f.Packs) CopySliceToDB(&folder.Folders, f.Folders) *dest = folder return true } type WorldFolder struct { Name string `json:"name"` Type string `json:"type"` ID string `json:"_id"` Folder string `json:"folder"` Sorting string `json:"sorting"` Sort int `json:"sort"` Stats Stats `json:"_stats,omitempty"` Description string `json:"description"` Color string `json:"color"` // Flags any `json:"flags,omitempty"` } func (w *WorldFolder) ToDB(dest *db.WorldFolder) bool { if dest == nil { return false } dest.Name = w.Name dest.Type = w.Type dest.ID = w.ID dest.Folder = w.Folder dest.Sorting = w.Sorting dest.Sort = w.Sort w.Stats.ToDB(&dest.Stats) dest.Description = w.Description dest.Color = w.Color return true }