finish setup data insertion, add world insertion
This commit is contained in:
@@ -20,6 +20,8 @@ func (f *Folder) ToDB(dest **db.Folder) bool {
|
||||
Sorting: f.Sorting,
|
||||
Color: f.Color,
|
||||
}
|
||||
|
||||
folder.Packs = make([]string, len(f.Packs))
|
||||
copy(folder.Packs, f.Packs)
|
||||
CopySliceToDB(&folder.Folders, f.Folders)
|
||||
|
||||
@@ -41,20 +43,25 @@ type WorldFolder struct {
|
||||
// Flags any `json:"flags,omitempty"`
|
||||
}
|
||||
|
||||
func (w *WorldFolder) ToDB(dest *db.WorldFolder) bool {
|
||||
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
|
||||
worldFolder := &db.WorldFolder{
|
||||
Name: w.Name,
|
||||
Type: w.Type,
|
||||
ID: w.ID,
|
||||
Folder: w.Folder,
|
||||
Sorting: w.Sorting,
|
||||
Sort: w.Sort,
|
||||
Description: w.Description,
|
||||
Color: w.Color,
|
||||
}
|
||||
|
||||
w.Stats.ToDB(&worldFolder.Stats)
|
||||
|
||||
*dest = worldFolder
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user