MCPcopy Create free account
hub / github.com/rilldata/rill / InsertProjectInvite

Method InsertProjectInvite

admin/database/postgres/postgres.go:2730–2751  ·  view source on GitHub ↗
(ctx context.Context, opts *database.InsertProjectInviteOptions)

Source from the content-addressed store, hash-verified

2728}
2729
2730func (c *connection) InsertProjectInvite(ctx context.Context, opts *database.InsertProjectInviteOptions) error {
2731 if err := database.Validate(opts); err != nil {
2732 return err
2733 }
2734 var inviterID any
2735 if opts.InviterID != "" {
2736 inviterID = opts.InviterID
2737 }
2738
2739 resJSON, err := marshalResourceNames(opts.Resources)
2740 if err != nil {
2741 return err
2742 }
2743
2744 _, err = c.getDB(ctx).ExecContext(ctx,
2745 `INSERT INTO project_invites (email, org_invite_id, project_id, project_role_id, invited_by_user_id, restrict_resources, resources) VALUES ($1, $2, $3, $4, $5, $6, $7)`,
2746 opts.Email, opts.OrgInviteID, opts.ProjectID, opts.RoleID, inviterID, opts.RestrictResources, resJSON)
2747 if err != nil {
2748 return parseErr("project invite", err)
2749 }
2750 return nil
2751}
2752
2753func (c *connection) DeleteProjectInvite(ctx context.Context, id string) error {
2754 res, err := c.getDB(ctx).ExecContext(ctx, "DELETE FROM project_invites WHERE id = $1", id)

Callers

nothing calls this directly

Calls 5

getDBMethod · 0.95
ValidateFunction · 0.92
marshalResourceNamesFunction · 0.85
parseErrFunction · 0.85
ExecContextMethod · 0.45

Tested by

no test coverage detected