@@ -82,7 +82,7 @@ type APITemplate struct {
82
82
CCOutDir string
83
83
}
84
84
85
- func Data (doc * docparser.SAIInfo , sai * saiast.SAIAPI , protoPackage , protoGoPackage , ccOutDir , protoOutDir string ) (* TemplateData , error ) {
85
+ func Data (doc * docparser.SAIInfo , sai * saiast.SAIAPI , protoPackage , protoGoPackage , ccOutDir , protoOutDir string , server bool ) (* TemplateData , error ) {
86
86
data := & TemplateData {
87
87
APIs : map [string ]* APITemplate {},
88
88
}
@@ -123,7 +123,7 @@ func Data(doc *docparser.SAIInfo, sai *saiast.SAIAPI, protoPackage, protoGoPacka
123
123
data .APIs [apiName ].Types = append (data .APIs [apiName ].Types , protoReqType , protoRespType )
124
124
}
125
125
126
- populateCCInfo (meta , apiName , sai , doc , fn , gFunc )
126
+ populateCCInfo (meta , apiName , sai , doc , fn , gFunc , server )
127
127
128
128
if gFunc .Operation == getAttrOp {
129
129
enum := genProtoEnum (doc , apiName , meta )
@@ -135,7 +135,7 @@ func Data(doc *docparser.SAIInfo, sai *saiast.SAIAPI, protoPackage, protoGoPacka
135
135
data .APIs [apiName ].Types = append (data .APIs [apiName ].Types , msgs ... )
136
136
}
137
137
if gFunc .Operation == createOp {
138
- convertFn := genConvertFunc (gFunc , meta , doc , sai , fn )
138
+ convertFn := genConvertFunc (gFunc , meta , doc , sai , fn , server )
139
139
data .APIs [apiName ].ConvertFuncs = append (data .APIs [apiName ].ConvertFuncs , convertFn )
140
140
}
141
141
data .APIs [apiName ].Funcs = append (data .APIs [apiName ].Funcs , gFunc )
@@ -144,7 +144,7 @@ func Data(doc *docparser.SAIInfo, sai *saiast.SAIAPI, protoPackage, protoGoPacka
144
144
return data , nil
145
145
}
146
146
147
- func genConvertFunc (genFunc * GenFunc , meta * saiast.FuncMetadata , info * docparser.SAIInfo , sai * saiast.SAIAPI , fn * saiast.TypeDecl ) * GenFunc {
147
+ func genConvertFunc (genFunc * GenFunc , meta * saiast.FuncMetadata , info * docparser.SAIInfo , sai * saiast.SAIAPI , fn * saiast.TypeDecl , server bool ) * GenFunc {
148
148
convertFn := & GenFunc {
149
149
Name : "convert_" + meta .Name ,
150
150
Operation : genFunc .Operation ,
@@ -209,7 +209,7 @@ func getParamDefs(params []saiast.TypeDecl) ([]string, []string) {
209
209
// populateCCInfo returns a two structs with the template data for the given function.
210
210
// The first is the implementation of the API: CreateFoo.
211
211
// The second is the a conversion func from attribute list to the proto message. covert_create_foo.
212
- func populateCCInfo (meta * saiast.FuncMetadata , apiName string , sai * saiast.SAIAPI , info * docparser.SAIInfo , fn * saiast.TypeDecl , genFunc * GenFunc ) {
212
+ func populateCCInfo (meta * saiast.FuncMetadata , apiName string , sai * saiast.SAIAPI , info * docparser.SAIInfo , fn * saiast.TypeDecl , genFunc * GenFunc , server bool ) {
213
213
if info .Attrs [meta .TypeName ] == nil {
214
214
fmt .Printf ("no doc info for type: %v\n " , meta .TypeName )
215
215
return
0 commit comments