-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.go
92 lines (72 loc) · 1.62 KB
/
demo.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package mano
import (
"log"
"os"
"github.com/junhwong/mano/logs"
"github.com/junhwong/mano/otpl"
)
// import (
// "log"
// "github.com/junhwong/mano/crypto"
// _ "github.com/junhwong/mano/crypto/bcrypt"
// )
type item struct {
current bool
name string
url string
}
func (i *item) Fn() string {
return "hello word"
}
// func (i *item) Hel2() string {
// return "hello word"
// }
func test() {
log.Print("")
}
func main() {
// typ:=reflect.TypeOf(test)
// panic(typ.Kind())
logs.SetLevel(logs.LDEBUG)
logs.Debug(logs.NewError(nil, "hello logs"))
//logs.Debug("print red color text :{red:%s}", "i'm red!")
//logs.Error("hello {red:%s}!","word")
return
data := make(map[string]interface{}, 0)
data["title"] = "OTPL!"
data["header"] = "Hello OTPL!"
items := make([]item, 0)
items = append(items, item{
current: true,
name: "James",
url: "http://example.com",
})
items = append(items, item{
name: "Foo1",
url: "http://example.com",
})
items = append(items, item{
name: "Foo2",
url: "http://example.com",
})
items = append(items, item{
name: "Foo3",
url: "http://example.com",
})
data["items"] = items
data["item"] = &item{}
// inst:=&item{}
// elem:=reflect.ValueOf(&inst).Elem()
//panic(fmt.Sprintf("%v",elem.CanAddr()))
//panic(elem.MethodByName("Hello"))
//panic(elem.NumMethod())
//vv:=reflect.TypeOf(elem)
//vv.Method(0).Func.Type().In(0).Name()
//panic(elem.Method(0).Type().In(0).Name())
rt := otpl.New("F:\\workspace\\otpl-node\\test\\.otpl")
err := rt.Render(data, "/case", os.Stdout) //develop
if err != nil {
//log.Debug(err)
panic(err)
}
}