finish world initialization, set up init on startup and on shutdown, move all models to main directory
This commit is contained in:
60
internal/foundry/models/json/ring.go
Normal file
60
internal/foundry/models/json/ring.go
Normal file
@@ -0,0 +1,60 @@
|
||||
package json
|
||||
|
||||
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/models/db"
|
||||
|
||||
type Ring struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
RingColors RingColors `json:"colors"`
|
||||
Effects int `json:"effects"`
|
||||
Subject Subject `json:"subject"`
|
||||
}
|
||||
|
||||
func (r *Ring) ToDB(dest **db.Ring) bool {
|
||||
if dest == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
ring := &db.Ring{
|
||||
Enabled: r.Enabled,
|
||||
Effects: r.Effects,
|
||||
}
|
||||
|
||||
r.RingColors.ToDB(&ring.RingColors)
|
||||
r.Subject.ToDB(&ring.Subject)
|
||||
|
||||
*dest = ring
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
type RingColors struct {
|
||||
Ring string `json:"ring"`
|
||||
Background string `json:"background"`
|
||||
}
|
||||
|
||||
func (r *RingColors) ToDB(dest *db.RingColors) bool {
|
||||
if dest == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
dest.Ring = r.Ring
|
||||
dest.Background = r.Background
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
type Subject struct {
|
||||
Scale int `json:"scale"`
|
||||
Texture string `json:"texture"`
|
||||
}
|
||||
|
||||
func (s *Subject) ToDB(dest *db.Subject) bool {
|
||||
if dest == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
dest.Scale = s.Scale
|
||||
dest.Texture = s.Texture
|
||||
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user