-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcategory.go
39 lines (32 loc) · 964 Bytes
/
category.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
package wu
import (
"github.com/mattn/go-ole"
"github.com/mattn/go-ole/oleutil"
)
type Categories struct {
categories *ole.IDispatch
Categories []*Category
}
type Category struct {
category *ole.IDispatch
CategoryID string
Name string
Description string
}
func newCategory(category *ole.IDispatch) *Category {
cat := new(Category)
cat.category = category
cat.CategoryID = oleutil.MustGetProperty(category, "CategoryID").ToString()
cat.Name = oleutil.MustGetProperty(category, "Name").ToString()
cat.Description = oleutil.MustGetProperty(category, "Description").ToString()
return cat
}
func (cat *Category) GetString(attr string) string {
return oleutil.MustGetProperty(cat.category, attr).ToString()
}
func (cat *Category) GetBool(attr string) bool {
return oleutil.MustGetProperty(cat.category, attr).Value().(bool)
}
func (cat *Category) GetInt(attr string) int {
return int(oleutil.MustGetProperty(cat.category, attr).Val)
}