Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8780e4e

Browse files
committed
Handle nil prepared case
1 parentd9d23b6 commit8780e4e

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

‎coderd/database/databasefake/databasefake.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -612,9 +612,11 @@ func (q *fakeQuerier) GetAuthorizedUserCount(ctx context.Context, params databas
612612
deferq.mutex.RUnlock()
613613

614614
// Call this to match the same function calls as the SQL implementation.
615-
_,err:=prepared.CompileToSQL(ctx,rbac.ConfigWithoutACL())
616-
iferr!=nil {
617-
return-1,err
615+
ifprepared!=nil {
616+
_,err:=prepared.CompileToSQL(ctx,rbac.ConfigWithoutACL())
617+
iferr!=nil {
618+
return-1,err
619+
}
618620
}
619621

620622
users:=make([]database.User,0,len(q.users))
@@ -895,10 +897,12 @@ func (q *fakeQuerier) GetAuthorizedWorkspaces(ctx context.Context, arg database.
895897
q.mutex.RLock()
896898
deferq.mutex.RUnlock()
897899

898-
// Call this to match the same function calls as the SQL implementation.
899-
_,err:=prepared.CompileToSQL(ctx,rbac.ConfigWithoutACL())
900-
iferr!=nil {
901-
returnnil,err
900+
ifprepared!=nil {
901+
// Call this to match the same function calls as the SQL implementation.
902+
_,err:=prepared.CompileToSQL(ctx,rbac.ConfigWithoutACL())
903+
iferr!=nil {
904+
returnnil,err
905+
}
902906
}
903907

904908
workspaces:=make([]database.Workspace,0)
@@ -1708,9 +1712,11 @@ func (q *fakeQuerier) GetAuthorizedTemplates(ctx context.Context, arg database.G
17081712
deferq.mutex.RUnlock()
17091713

17101714
// Call this to match the same function calls as the SQL implementation.
1711-
_,err:=prepared.CompileToSQL(ctx,rbac.ConfigWithoutACL())
1712-
iferr!=nil {
1713-
returnnil,err
1715+
ifprepared!=nil {
1716+
_,err:=prepared.CompileToSQL(ctx,rbac.ConfigWithACL())
1717+
iferr!=nil {
1718+
returnnil,err
1719+
}
17141720
}
17151721

17161722
vartemplates []database.Template

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp