MCPcopy Create free account
hub / github.com/OpenCSGs/csghub-server / ListDatasetsByPath

Method ListDatasetsByPath

component/list.go:62–95  ·  view source on GitHub ↗
(ctx context.Context, req *types.ListByPathReq)

Source from the content-addressed store, hash-verified

60}
61
62func (c *ListComponent) ListDatasetsByPath(ctx context.Context, req *types.ListByPathReq) ([]*types.DatasetResp, error) {
63 var datasetResp []*types.DatasetResp
64
65 datasets, err := c.ds.ListByPath(ctx, req.Paths)
66 if err != nil {
67 slog.Error("error listing datasets by path: %v", err, slog.Any("paths", req.Paths))
68 return nil, err
69 }
70 for _, dataset := range datasets {
71 var tags []types.RepoTag
72 for _, tag := range dataset.Repository.Tags {
73 tags = append(tags, types.RepoTag{
74 Name: tag.Name,
75 Category: tag.Category,
76 Group: tag.Group,
77 BuiltIn: tag.BuiltIn,
78 ShowName: tag.ShowName,
79 CreatedAt: tag.CreatedAt,
80 UpdatedAt: tag.UpdatedAt,
81 })
82 }
83 datasetResp = append(datasetResp, &types.ModelResp{
84 Name: dataset.Repository.Name,
85 Path: dataset.Repository.Path,
86 Downloads: dataset.Repository.DownloadCount,
87 UpdatedAt: dataset.UpdatedAt,
88 Private: dataset.Repository.Private,
89 Nickname: dataset.Repository.Nickname,
90 Description: dataset.Repository.Description,
91 Tags: tags,
92 })
93 }
94 return datasetResp, nil
95}

Callers

nothing calls this directly

Calls 2

ErrorMethod · 0.80
ListByPathMethod · 0.45

Tested by

no test coverage detected