update proto generation from DSL
This commit is contained in:
@ -128,12 +128,40 @@ func (ti *TemplateInterpreter) Interpret(masonryInput string, tmplText string) (
|
||||
}
|
||||
return 8080
|
||||
},
|
||||
"getServerHostPort": func(settings []lang.ServerSetting) string {
|
||||
host := "localhost"
|
||||
port := 8080
|
||||
for _, s := range settings {
|
||||
if s.Host != nil {
|
||||
host = *s.Host
|
||||
}
|
||||
if s.Port != nil {
|
||||
port = *s.Port
|
||||
}
|
||||
}
|
||||
return fmt.Sprintf("%s:%d", host, port)
|
||||
},
|
||||
"slice": func() []interface{} {
|
||||
return []interface{}{}
|
||||
},
|
||||
"append": func(slice []interface{}, item interface{}) []interface{} {
|
||||
return append(slice, item)
|
||||
},
|
||||
"add": func(a, b int) int {
|
||||
return a + b
|
||||
},
|
||||
"derefString": func(s *string) string {
|
||||
if s != nil {
|
||||
return *s
|
||||
}
|
||||
return ""
|
||||
},
|
||||
"derefInt": func(i *int) int {
|
||||
if i != nil {
|
||||
return *i
|
||||
}
|
||||
return 0
|
||||
},
|
||||
}).Parse(tmplText))
|
||||
|
||||
data := struct {
|
||||
@ -219,12 +247,40 @@ func NewTemplateRegistry() *TemplateRegistry {
|
||||
}
|
||||
return 8080
|
||||
},
|
||||
"getServerHostPort": func(settings []lang.ServerSetting) string {
|
||||
host := "localhost"
|
||||
port := 8080
|
||||
for _, s := range settings {
|
||||
if s.Host != nil {
|
||||
host = *s.Host
|
||||
}
|
||||
if s.Port != nil {
|
||||
port = *s.Port
|
||||
}
|
||||
}
|
||||
return fmt.Sprintf("%s:%d", host, port)
|
||||
},
|
||||
"slice": func() []interface{} {
|
||||
return []interface{}{}
|
||||
},
|
||||
"append": func(slice []interface{}, item interface{}) []interface{} {
|
||||
return append(slice, item)
|
||||
},
|
||||
"add": func(a, b int) int {
|
||||
return a + b
|
||||
},
|
||||
"derefString": func(s *string) string {
|
||||
if s != nil {
|
||||
return *s
|
||||
}
|
||||
return ""
|
||||
},
|
||||
"derefInt": func(i *int) int {
|
||||
if i != nil {
|
||||
return *i
|
||||
}
|
||||
return 0
|
||||
},
|
||||
}
|
||||
return tr
|
||||
}
|
||||
|
Reference in New Issue
Block a user