Create NewPersion function

This commit is contained in:
Jason Streifling 2024-10-15 16:07:41 +02:00
parent 3929892602
commit d2a050bd8f

View File

@ -13,6 +13,10 @@ type Person struct {
Extensions []*ExtensionElement `xml:",any,omitempty"`
}
func NewPerson(name string) *Person {
return &Person{Name: name}
}
func (p *Person) Check() error {
if p.Name == "" {
return errors.New("name element of person element empty")