finish setup data insertion, add world insertion
This commit is contained in:
@@ -21,27 +21,31 @@ type CardDeck struct {
|
||||
// Cards0System any `json:"system"`
|
||||
}
|
||||
|
||||
func (c *CardDeck) ToDB(dest *db.CardDeck) bool {
|
||||
func (c *CardDeck) ToDB(dest **db.CardDeck) bool {
|
||||
if dest == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
dest.Name = c.Name
|
||||
dest.Type = c.Type
|
||||
dest.Description = c.Description
|
||||
dest.Img = c.Img
|
||||
dest.Width = c.Width
|
||||
dest.Height = c.Height
|
||||
dest.Rotation = c.Rotation
|
||||
dest.DisplayCount = c.DisplayCount
|
||||
dest.Folder = c.Folder
|
||||
dest.Sort = c.Sort
|
||||
dest.ID = c.ID
|
||||
cardDeck := &db.CardDeck{
|
||||
Name: c.Name,
|
||||
Type: c.Type,
|
||||
Description: c.Description,
|
||||
Img: c.Img,
|
||||
Width: c.Width,
|
||||
Height: c.Height,
|
||||
Rotation: c.Rotation,
|
||||
DisplayCount: c.DisplayCount,
|
||||
Folder: c.Folder,
|
||||
Sort: c.Sort,
|
||||
ID: c.ID,
|
||||
}
|
||||
|
||||
c.Stats.ToDB(&dest.Stats)
|
||||
c.Ownership.ToDB(&dest.Ownership)
|
||||
c.Stats.ToDB(&cardDeck.Stats)
|
||||
c.Ownership.ToDB(&cardDeck.Ownership)
|
||||
|
||||
CopySliceToDB(&dest.Cards, c.Cards)
|
||||
CopySliceToDB(&cardDeck.Cards, c.Cards)
|
||||
|
||||
*dest = cardDeck
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -67,29 +71,33 @@ type Card struct {
|
||||
// System any `json:"system"`
|
||||
}
|
||||
|
||||
func (c *Card) ToDB(dest *db.Card) bool {
|
||||
func (c *Card) ToDB(dest **db.Card) bool {
|
||||
if dest == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
dest.Name = c.Name
|
||||
dest.Width = c.Width
|
||||
dest.Height = c.Height
|
||||
dest.Rotation = c.Rotation
|
||||
dest.Type = c.Type
|
||||
dest.Value = c.Value
|
||||
dest.Suit = c.Suit
|
||||
dest.Description = c.Description
|
||||
dest.Face = c.Face
|
||||
dest.Drawn = c.Drawn
|
||||
dest.Origin = c.Origin
|
||||
dest.ID = c.ID
|
||||
dest.Sort = c.Sort
|
||||
card := &db.Card{
|
||||
Name: c.Name,
|
||||
Width: c.Width,
|
||||
Height: c.Height,
|
||||
Rotation: c.Rotation,
|
||||
Type: c.Type,
|
||||
Value: c.Value,
|
||||
Suit: c.Suit,
|
||||
Description: c.Description,
|
||||
Face: c.Face,
|
||||
Drawn: c.Drawn,
|
||||
Origin: c.Origin,
|
||||
ID: c.ID,
|
||||
Sort: c.Sort,
|
||||
}
|
||||
|
||||
c.Back.ToDB(&dest.Back)
|
||||
c.Stats.ToDB(&dest.Stats)
|
||||
c.Back.ToDB(&card.Back)
|
||||
c.Stats.ToDB(&card.Stats)
|
||||
|
||||
CopySliceToDB(&dest.Faces, c.Faces)
|
||||
CopySliceToDB(&card.Faces, c.Faces)
|
||||
|
||||
*dest = card
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user