update proto generation from DSL

This commit is contained in:
2025-09-01 15:57:22 -06:00
parent ca0736b92c
commit c6f14e1787
4 changed files with 308 additions and 64 deletions

View File

@ -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
}