Create NewPersion function
This commit is contained in:
parent
3929892602
commit
d2a050bd8f
@ -13,6 +13,10 @@ type Person struct {
|
|||||||
Extensions []*ExtensionElement `xml:",any,omitempty"`
|
Extensions []*ExtensionElement `xml:",any,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewPerson(name string) *Person {
|
||||||
|
return &Person{Name: name}
|
||||||
|
}
|
||||||
|
|
||||||
func (p *Person) Check() error {
|
func (p *Person) Check() error {
|
||||||
if p.Name == "" {
|
if p.Name == "" {
|
||||||
return errors.New("name element of person element empty")
|
return errors.New("name element of person element empty")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user