Skip to content

Commit f310c71

Browse files
committed
pr comments
1 parent 89bf77c commit f310c71

File tree

19 files changed

+78
-89
lines changed

19 files changed

+78
-89
lines changed

cli/start.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func start() *cobra.Command {
129129
return xerrors.Errorf("parse access url %q: %w", accessURL, err)
130130
}
131131

132-
sshKeygenAlgorithm, err := gitsshkey.ParseSSHKeygenAlgorithm(sshKeygenAlgorithmRaw)
132+
sshKeygenAlgorithm, err := gitsshkey.ParseAlgorithm(sshKeygenAlgorithmRaw)
133133
if err != nil {
134134
return xerrors.Errorf("parse ssh keygen algorithm %s: %w", sshKeygenAlgorithmRaw, err)
135135
}

coderd/database/databasefake/databasefake.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func New() database.Store {
3131
provisionerJobResource: make([]database.WorkspaceResource, 0),
3232
workspaceBuild: make([]database.WorkspaceBuild, 0),
3333
provisionerJobAgent: make([]database.WorkspaceAgent, 0),
34-
gitsshkey: make([]database.GitSshKey, 0),
34+
GitSSHKey: make([]database.GitSSHKey, 0),
3535
}
3636
}
3737

@@ -58,7 +58,7 @@ type fakeQuerier struct {
5858
provisionerJobLog []database.ProvisionerJobLog
5959
workspace []database.Workspace
6060
workspaceBuild []database.WorkspaceBuild
61-
gitsshkey []database.GitSshKey
61+
GitSSHKey []database.GitSSHKey
6262
}
6363

6464
// InTx doesn't rollback data properly for in-memory yet.
@@ -1242,46 +1242,46 @@ func (q *fakeQuerier) UpdateWorkspaceDeletedByID(_ context.Context, arg database
12421242
return sql.ErrNoRows
12431243
}
12441244

1245-
func (q *fakeQuerier) InsertGitSSHKey(_ context.Context, arg database.InsertGitSSHKeyParams) (database.GitSshKey, error) {
1245+
func (q *fakeQuerier) InsertGitSSHKey(_ context.Context, arg database.InsertGitSSHKeyParams) (database.GitSSHKey, error) {
12461246
q.mutex.Lock()
12471247
defer q.mutex.Unlock()
12481248

12491249
//nolint:gosimple
1250-
gitsshkey := database.GitSshKey{
1250+
GitSSHKey := database.GitSSHKey{
12511251
UserID: arg.UserID,
12521252
CreatedAt: arg.CreatedAt,
12531253
UpdatedAt: arg.UpdatedAt,
12541254
PrivateKey: arg.PrivateKey,
12551255
PublicKey: arg.PublicKey,
12561256
}
1257-
q.gitsshkey = append(q.gitsshkey, gitsshkey)
1258-
return gitsshkey, nil
1257+
q.GitSSHKey = append(q.GitSSHKey, GitSSHKey)
1258+
return GitSSHKey, nil
12591259
}
12601260

1261-
func (q *fakeQuerier) GetGitSSHKey(_ context.Context, userID uuid.UUID) (database.GitSshKey, error) {
1261+
func (q *fakeQuerier) GetGitSSHKey(_ context.Context, userID uuid.UUID) (database.GitSSHKey, error) {
12621262
q.mutex.RLock()
12631263
defer q.mutex.RUnlock()
12641264

1265-
for _, key := range q.gitsshkey {
1265+
for _, key := range q.GitSSHKey {
12661266
if key.UserID == userID {
12671267
return key, nil
12681268
}
12691269
}
1270-
return database.GitSshKey{}, sql.ErrNoRows
1270+
return database.GitSSHKey{}, sql.ErrNoRows
12711271
}
12721272

12731273
func (q *fakeQuerier) UpdateGitSSHKey(_ context.Context, arg database.UpdateGitSSHKeyParams) error {
12741274
q.mutex.Lock()
12751275
defer q.mutex.Unlock()
12761276

1277-
for index, key := range q.gitsshkey {
1277+
for index, key := range q.GitSSHKey {
12781278
if key.UserID.String() != arg.UserID.String() {
12791279
continue
12801280
}
12811281
key.UpdatedAt = arg.UpdatedAt
12821282
key.PrivateKey = arg.PrivateKey
12831283
key.PublicKey = arg.PublicKey
1284-
q.gitsshkey[index] = key
1284+
q.GitSSHKey[index] = key
12851285
return nil
12861286
}
12871287
return sql.ErrNoRows
@@ -1291,12 +1291,12 @@ func (q *fakeQuerier) DeleteGitSSHKey(_ context.Context, userID uuid.UUID) error
12911291
q.mutex.Lock()
12921292
defer q.mutex.Unlock()
12931293

1294-
for index, key := range q.gitsshkey {
1294+
for index, key := range q.GitSSHKey {
12951295
if key.UserID.String() != userID.String() {
12961296
continue
12971297
}
1298-
q.gitsshkey[index] = q.gitsshkey[len(q.gitsshkey)-1]
1299-
q.gitsshkey = q.gitsshkey[:len(q.gitsshkey)-1]
1298+
q.GitSSHKey[index] = q.GitSSHKey[len(q.GitSSHKey)-1]
1299+
q.GitSSHKey = q.GitSSHKey[:len(q.GitSSHKey)-1]
13001300
return nil
13011301
}
13021302
return sql.ErrNoRows

coderd/database/dump.sql

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
DROP TABLE git_ssh_keys;
1+
DROP TABLE gitsshkeys;

coderd/database/migrations/000005_gitsshkey.up.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CREATE TABLE IF NOT EXISTS git_ssh_keys (
1+
CREATE TABLE IF NOT EXISTS gitsshkeys (
22
user_id uuid PRIMARY KEY NOT NULL REFERENCES users (id),
33
created_at timestamptz NOT NULL,
44
updated_at timestamptz NOT NULL,

coderd/database/models.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/querier.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/gitsshkeys.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- name: InsertGitSSHKey :one
22
INSERT INTO
3-
git_ssh_keys (
3+
gitsshkeys (
44
user_id,
55
created_at,
66
updated_at,
@@ -14,13 +14,13 @@ VALUES
1414
SELECT
1515
*
1616
FROM
17-
git_ssh_keys
17+
gitsshkeys
1818
WHERE
1919
user_id = $1;
2020

2121
-- name: UpdateGitSSHKey :exec
2222
UPDATE
23-
git_ssh_keys
23+
gitsshkeys
2424
SET
2525
updated_at = $2,
2626
private_key = $3,
@@ -30,6 +30,6 @@ WHERE
3030

3131
-- name: DeleteGitSSHKey :exec
3232
DELETE FROM
33-
git_ssh_keys
33+
gitsshkeys
3434
WHERE
3535
user_id = $1;

coderd/database/sqlc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ rename:
2727
oidc_refresh_token: OIDCRefreshToken
2828
parameter_type_system_hcl: ParameterTypeSystemHCL
2929
userstatus: UserStatus
30+
gitsshkey: GitSSHKey

0 commit comments

Comments
 (0)