-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
52 lines (42 loc) · 1.22 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package healthkit
import (
"encoding/xml"
"fmt"
"time"
)
const timeFormat = "2006-01-02 15:04:05 Z0700"
type Data interface {
fmt.Stringer
sealed()
}
func (as *ActivitySummary) sealed() {}
func (c *Correlation) sealed() {}
func (r *Record) sealed() {}
func (w *Workout) sealed() {}
// for https://github.com/BurntSushi/go-sumtype
//go-sumtype:decl Data
type Meta struct {
Locale string
ExportDate ExportDate
Me Me
}
type ExportDate struct {
XMLName xml.Name `xml:"ExportDate"`
Value string `xml:"value,attr"`
}
type Me struct {
XMLName xml.Name `xml:"Me"`
DateOfBirth string `xml:"HKCharacteristicTypeIdentifierDateOfBirth,attr"`
BiologicalSex BiologicalSex `xml:"HKCharacteristicTypeIdentifierBiologicalSex,attr"`
BloodType BloodType `xml:"HKCharacteristicTypeIdentifierBloodType,attr"`
FitzpatrickSkinType string `xml:"HKCharacteristicTypeIdentifierFitzpatrickSkinType,attr"`
}
func (me *Me) DateOfBirthTime() time.Time {
d, _ := time.Parse("2006-01-02", me.DateOfBirth)
return d
}
type MetadataEntry struct {
XMLName xml.Name `xml:"MetadataEntry"`
Key string `xml:"key,attr"`
Value string `xml:"value,attr"`
}