dorfylegends/backend/model/util.go
Robert Janetzko 77b720f8d2 restructure
2022-04-14 13:59:47 +00:00

51 lines
836 B
Go

package model
import "encoding/xml"
type NamedObject struct {
Id_ int `xml:"id" json:"id"`
Name_ string `xml:"name" json:"name"`
}
func (r *NamedObject) Id() int { return r.Id_ }
func (r *NamedObject) Name() string { return r.Name_ }
type Named interface {
Id() int
Name() string
}
type Identifiable interface {
Id() int
}
type TypedObject struct {
Type_ string `xml:"type" json:"type"`
}
func (r *TypedObject) Type() string { return r.Type_ }
type Typed interface {
Type() string
}
type OtherElements struct {
Others_ []Element `xml:",any" json:"-"`
}
func (r *OtherElements) Others() []Element { return r.Others_ }
type Others interface {
Others() []Element
}
type TypedOthers interface {
Type() string
Others() []Element
}
type Element struct {
XMLName xml.Name
Value string `xml:",innerxml"`
}