MCPcopy
hub / github.com/rilldata/rill / UpdateUser

Method UpdateUser

admin/database/postgres/postgres.go:932–953  ·  view source on GitHub ↗
(ctx context.Context, id string, opts *database.UpdateUserOptions)

Source from the content-addressed store, hash-verified

930}
931
932func (c *connection) UpdateUser(ctx context.Context, id string, opts *database.UpdateUserOptions) (*database.User, error) {
933 if err := database.Validate(opts); err != nil {
934 return nil, err
935 }
936
937 res := &database.User{}
938 err := c.getDB(ctx).QueryRowxContext(ctx, "UPDATE users SET display_name=$2, photo_url=$3, github_username=$4, github_token=$5, github_token_expires_on=$6, github_refresh_token=$7, quota_singleuser_orgs=$8, quota_trial_orgs=$9, preference_time_zone=$10, updated_on=now() WHERE id=$1 RETURNING *",
939 id,
940 opts.DisplayName,
941 opts.PhotoURL,
942 opts.GithubUsername,
943 opts.GithubToken,
944 opts.GithubTokenExpiresOn,
945 opts.GithubRefreshToken,
946 opts.QuotaSingleuserOrgs,
947 opts.QuotaTrialOrgs,
948 opts.PreferenceTimeZone).StructScan(res)
949 if err != nil {
950 return nil, parseErr("user", err)
951 }
952 return res, nil
953}
954
955func (c *connection) UpdateUserActiveOn(ctx context.Context, ids []string) error {
956 _, err := c.getDB(ctx).ExecContext(ctx, "UPDATE users SET active_on=now() WHERE id=ANY($1)", ids)

Callers

nothing calls this directly

Calls 3

getDBMethod · 0.95
ValidateFunction · 0.92
parseErrFunction · 0.85

Tested by

no test coverage detected