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

Method FindByPath

builder/store/database/code.go:141–160  ·  view source on GitHub ↗
(ctx context.Context, namespace string, repoPath string)

Source from the content-addressed store, hash-verified

139}
140
141func (s *CodeStore) FindByPath(ctx context.Context, namespace string, repoPath string) (code *Code, err error) {
142 resCode := new(Code)
143 err = s.db.Operator.Core.
144 NewSelect().
145 Model(resCode).
146 Relation("Repository.User").
147 Where("repository.path =?", fmt.Sprintf("%s/%s", namespace, repoPath)).
148 Scan(ctx)
149 if err != nil {
150 return nil, fmt.Errorf("failed to find code: %w", err)
151 }
152 err = s.db.Operator.Core.NewSelect().
153 Model(resCode.Repository).
154 WherePK().
155 Relation("Tags", func(sq *bun.SelectQuery) *bun.SelectQuery {
156 return sq.Where("repository_tag.count > 0")
157 }).
158 Scan(ctx)
159 return resCode, err
160}
161
162func (s *CodeStore) Delete(ctx context.Context, input Code) error {
163 res, err := s.db.Operator.Core.NewDelete().Model(&input).WherePK().Exec(ctx)

Callers 15

ShowMethod · 0.45
DeleteMethod · 0.45
DeployMethod · 0.45
WakeupMethod · 0.45
StopMethod · 0.45
StatusMethod · 0.45
LogsMethod · 0.45
DeleteMethod · 0.45
ShowMethod · 0.45
GetServerlessMethod · 0.45
SDKModelInfoMethod · 0.45
RelationsMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected