forked from ZhouYuling/learnGO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvcard.go
43 lines (34 loc) · 918 Bytes
/
vcard.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
package main
import (
"time"
"fmt"
)
type Address struct {
Street string
HouseNumber uint32
HouseNumberAddOn string
POBox string
ZipCode string
City string
Country string
}
type VCard struct {
FirstName string
LastName string
NickName string
BirtDate time.Time
Photo string
Addresses map[string]*Address
}
func main() {
addr1 := &Address{"Elfenstraat", 12, "", "", "2600", "Mechelen", "België"}
addr2 := &Address{"Heideland", 28, "", "", "2640", "Mortsel", "België"}
addrs := make(map[string]*Address)
addrs["youth"] = addr1
addrs["now"] = addr2
birthdt := time.Date(1956, 1, 17, 15, 4, 5, 0, time.Local)
photo := "MyDocuments/MyPhotos/photo1.jpg"
vcard := &VCard{"Ivo", "Balbaert", "", birthdt, photo, addrs}
fmt.Printf("Here is the full VCard: %v\n", vcard)
fmt.Printf("My Addresses are:\n %v\n %v", addr1, addr2)
}