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

Method FindOrganizationsForUser

admin/database/postgres/postgres.go:68–79  ·  view source on GitHub ↗
(ctx context.Context, userID, afterName string, limit int)

Source from the content-addressed store, hash-verified

66}
67
68func (c *connection) FindOrganizationsForUser(ctx context.Context, userID, afterName string, limit int) ([]*database.Organization, error) {
69 var res []*database.Organization
70 err := c.getDB(ctx).SelectContext(ctx, &res, `
71 SELECT o.* FROM orgs o
72 WHERE o.id IN (SELECT uor.org_id FROM users_orgs_roles uor WHERE uor.user_id = $1)
73 AND lower(o.name) > lower($2) ORDER BY lower(o.name) LIMIT $3
74 `, userID, afterName, limit)
75 if err != nil {
76 return nil, parseErr("orgs", err)
77 }
78 return res, nil
79}
80
81func (c *connection) FindOrganization(ctx context.Context, orgID string) (*database.Organization, error) {
82 res := &database.Organization{}

Callers

nothing calls this directly

Calls 3

getDBMethod · 0.95
parseErrFunction · 0.85
SelectContextMethod · 0.80

Tested by

no test coverage detected