Add arithmetics helpers - fix #94

This commit is contained in:
Tommy PAGEARD
2018-03-21 14:41:40 +01:00
parent 77a820ea6f
commit 19fb3c8da9
7 changed files with 69 additions and 2 deletions

View File

@@ -133,6 +133,21 @@ var ProtoHelpersFuncMap = template.FuncMap{
"fieldMapKeyType": fieldMapKeyType,
"fieldMapValueType": fieldMapValueType,
"replaceDict": replaceDict,
"add": func(a int, b int) int {
return a + b
},
"subtract": func(a int, b int) int {
return a - b
},
"multiply": func(a int, b int) int {
return a * b
},
"divide": func(a int, b int) int {
if b == 0 {
panic("psssst ... little help here ... you cannot divide by 0")
}
return a / b
},
}
var pathMap map[interface{}]*descriptor.SourceCodeInfo_Location