serverStructWSSections return section templates that generate WebSocket related struct type definitions for the server.
(data *ServiceData)
| 306 | // serverStructWSSections return section templates that generate WebSocket |
| 307 | // related struct type definitions for the server. |
| 308 | func serverStructWSSections(data *ServiceData) []*codegen.SectionTemplate { |
| 309 | var sections []*codegen.SectionTemplate |
| 310 | sections = append(sections, &codegen.SectionTemplate{ |
| 311 | Name: "server-websocket-conn-configurer-struct", |
| 312 | Source: httpTemplates.Read(websocketConnConfigurerStructT), |
| 313 | Data: data, |
| 314 | FuncMap: map[string]any{"isWebSocketEndpoint": IsWebSocketEndpoint}, |
| 315 | }) |
| 316 | for _, e := range data.Endpoints { |
| 317 | if e.ServerWebSocket != nil { |
| 318 | sections = append(sections, &codegen.SectionTemplate{ |
| 319 | Name: "server-websocket-struct-type", |
| 320 | Source: httpTemplates.Read(websocketStructTypeT), |
| 321 | Data: e.ServerWebSocket, |
| 322 | }) |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | return sections |
| 327 | } |
| 328 | |
| 329 | // serverWSSections returns section templates that contain server WebSocket |
| 330 | // specific code for the given service. |
no test coverage detected