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

Method FindInactiveOrganizations

admin/database/postgres/postgres.go:207–219  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

205}
206
207func (c *connection) FindInactiveOrganizations(ctx context.Context) ([]*database.Organization, error) {
208 // TODO: This definition may change, but for now, we are considering an organization as inactive if it has no users
209 res := []*database.Organization{}
210 err := c.getDB(ctx).SelectContext(ctx, &res, `
211 SELECT o.* FROM orgs o
212 WHERE now() - o.updated_on > INTERVAL '1 DAY'
213 AND NOT EXISTS ( SELECT 1 FROM users_orgs_roles uor WHERE uor.org_id = o.id )
214 `)
215 if err != nil {
216 return nil, parseErr("orgs", err)
217 }
218 return res, nil
219}
220
221func (c *connection) FindProjects(ctx context.Context, afterID string, limit int) ([]*database.Project, error) {
222 var qry strings.Builder

Callers

nothing calls this directly

Calls 3

getDBMethod · 0.95
parseErrFunction · 0.85
SelectContextMethod · 0.80

Tested by

no test coverage detected