MCPcopy Index your code
hub / github.com/rilldata/rill / FindProjectsForUser

Method FindProjectsForUser

admin/database/postgres/postgres.go:290–304  ·  view source on GitHub ↗
(ctx context.Context, userID string)

Source from the content-addressed store, hash-verified

288}
289
290func (c *connection) FindProjectsForUser(ctx context.Context, userID string) ([]*database.Project, error) {
291 var res []*projectDTO
292 err := c.getDB(ctx).SelectContext(ctx, &res, `
293 SELECT * FROM projects
294 WHERE id IN (
295 SELECT upr.project_id FROM users_projects_roles upr WHERE upr.user_id = $1
296 UNION
297 SELECT ugpr.project_id FROM usergroups_projects_roles ugpr JOIN usergroups_users ugu ON ugpr.usergroup_id = ugu.usergroup_id WHERE ugu.user_id = $1
298 )
299 `, userID)
300 if err != nil {
301 return nil, parseErr("projects", err)
302 }
303 return c.projectsFromDTOs(res)
304}
305
306// FindProjectsForUserAndFingerprint returns projects for the user based on fingerprint.
307// The fingerprint is simply git_remote + subpath for git based projects.

Callers

nothing calls this directly

Calls 4

getDBMethod · 0.95
projectsFromDTOsMethod · 0.95
parseErrFunction · 0.85
SelectContextMethod · 0.80

Tested by

no test coverage detected