MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / OnInit

Method OnInit

module/service/iml.go:302–341  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

300}
301
302func (i *imlServiceModule) OnInit() {
303 register.Handle(func(v server.Server) {
304 ctx := context.Background()
305 services, err := i.serviceService.ServiceList(ctx)
306 if err != nil {
307 log.Error(err)
308 return
309 }
310
311 for _, s := range services {
312 err = i.updateMCPServer(ctx, s.Id, s.Name, "1.0")
313 if err != nil {
314 log.Error(err)
315 return
316 }
317 }
318 overviews, err := i.serviceOverviewService.List(ctx)
319 if err != nil {
320 log.Error(err)
321 return
322 }
323 if len(overviews) > 0 {
324 return
325 }
326 countMap, err := i.apiDocService.APICountByServices(ctx)
327 if err != nil {
328 log.Error(err)
329 return
330 }
331 for k, v := range countMap {
332 err = i.serviceOverviewService.Update(ctx, k, &service_overview.Update{
333 ApiCount: &v,
334 })
335 if err != nil {
336 log.Error(err)
337 return
338 }
339 }
340 })
341}
342
343func (i *imlServiceModule) initGateway(ctx context.Context, clusterId string, clientDriver gateway.IClientDriver) error {
344 services, err := i.serviceService.ServiceList(ctx)

Callers

nothing calls this directly

Calls 5

updateMCPServerMethod · 0.95
ServiceListMethod · 0.65
ListMethod · 0.65
APICountByServicesMethod · 0.65
UpdateMethod · 0.65

Tested by

no test coverage detected