Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type Timestamp time.Time
- func (t *Timestamp) MarshalXMLAttr(name xml.Name) (xml.Attr, error) {
- return xml.Attr{Name: name, Value: t.time2str()}, nil
- }
- func (t *Timestamp) UnmarshalXMLAttr(attr xml.Attr) (err error) {
- return t.str2time(attr.Value)
- }
- type MyStruct struct {
- Start Timestamp `xml:"start,attr"`
- }
- import MyPkg "github.com/user/pkg"
- ...
- var MyStructDefinition MyPkg.MyStruct
- MyStructDefinition.Timestamp = MyPkg.Timestamp{}
- marshalled, err := xml.Marshal(run)
- if err != nil {
- fmt.Println(err)
- }
- xml: unsupported type: MyPkg.Timestamp
Add Comment
Please, Sign In to add comment