MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / ConvertStruct

Function ConvertStruct

module/ai-api/iml.go:346–357  ·  view source on GitHub ↗
(data interface{})

Source from the content-addressed store, hash-verified

344}
345
346func ConvertStruct[T any](data interface{}) (*T, error) {
347 b, err := json.Marshal(data)
348 if err != nil {
349 return nil, err
350 }
351 var t T
352 err = json.Unmarshal(b, &t)
353 if err != nil {
354 return nil, err
355 }
356 return &t, nil
357}
358
359func (i *imlAPIModule) Prefix(ctx context.Context, serviceId string) (string, error) {
360 pInfo, err := i.serviceService.Check(ctx, serviceId, map[string]bool{"as_server": true})

Callers

nothing calls this directly

Calls 1

MarshalMethod · 0.80

Tested by

no test coverage detected