Initial code to generate service code.
This commit is contained in:
		
							
								
								
									
										31
									
								
								v2alpha/srv/srv.gotemplate
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								v2alpha/srv/srv.gotemplate
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| {{define "service"}} | ||||
| {{- $Imps := .Imps}} | ||||
| package TODO | ||||
|  | ||||
| import ( | ||||
| {{- range .Imps.ImportLines}} | ||||
|   {{quote .Alias}} {{.Path}} | ||||
| {{- end}} | ||||
| ) | ||||
|  | ||||
| {{range .SCPD.SortedActions}} | ||||
| {{- template "action" args "Action" . "Imps" $Imps}} | ||||
| {{end}} | ||||
| {{end}} | ||||
|  | ||||
| {{define "action"}} | ||||
| type {{.Action.Name}}Request struct { | ||||
| {{- template "args" args "Args" .Action.InArgs "Imps" .Imps -}} | ||||
| } | ||||
|  | ||||
| type {{.Action.Name}}Response struct { | ||||
| {{- template "args" args "Args" .Action.OutArgs "Imps" .Imps  -}} | ||||
| } | ||||
| {{- end}} | ||||
|  | ||||
| {{define "args"}} | ||||
| {{- $Imps := .Imps}} | ||||
| {{- range .Args}} | ||||
|   {{.Name}} {{index $Imps.TypeRefByTypeName .RelatedStateVariable.DataType}} | ||||
| {{end}} | ||||
| {{- end}} | ||||
		Reference in New Issue
	
	Block a user