init
This commit is contained in:
36
internal/foundry/models/system.go
Normal file
36
internal/foundry/models/system.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package models
|
||||
|
||||
type System struct {
|
||||
Id string
|
||||
Title string
|
||||
Description string
|
||||
Url string
|
||||
Compatibility Compatibility
|
||||
Download string
|
||||
}
|
||||
|
||||
type Systems []System
|
||||
|
||||
func (systems Systems) GetById(id int) *System {
|
||||
return &systems[id]
|
||||
}
|
||||
|
||||
func (state *FoundryState) GetSystems() Systems {
|
||||
systemsCopy := make([]System, 0, 8)
|
||||
for i := range state.Systems {
|
||||
system := &(state.Systems[i])
|
||||
systemCopy := System{
|
||||
Id: system.Id,
|
||||
Title: system.Title,
|
||||
Description: system.Description,
|
||||
Url: system.Url,
|
||||
Compatibility: Compatibility{
|
||||
Minimum: system.Compatibility.Minimum,
|
||||
Maximum: system.Compatibility.Maximum,
|
||||
},
|
||||
Download: system.Download,
|
||||
}
|
||||
systemsCopy = append(systemsCopy, systemCopy)
|
||||
}
|
||||
return systemsCopy
|
||||
}
|
||||
Reference in New Issue
Block a user