dorfylegends/backend/model/util.go

46 lines
724 B
Go
Raw Normal View History

2022-04-09 19:37:44 +03:00
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
2022-04-28 22:24:55 +03:00
setId(int)
2022-04-09 19:37:44 +03:00
}
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"`
}