@@ -512,9 +512,9 @@ func As(ctx context.Context, actor rbac.Subject) context.Context {
512
512
// running the insertFunc. The insertFunc is expected to return the object that
513
513
// was inserted.
514
514
func insert [
515
- ObjectType any ,
516
- ArgumentType any ,
517
- Insert func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
515
+ ObjectType any ,
516
+ ArgumentType any ,
517
+ Insert func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
518
518
](
519
519
logger slog.Logger ,
520
520
authorizer rbac.Authorizer ,
@@ -525,9 +525,9 @@ func insert[
525
525
}
526
526
527
527
func insertWithAction [
528
- ObjectType any ,
529
- ArgumentType any ,
530
- Insert func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
528
+ ObjectType any ,
529
+ ArgumentType any ,
530
+ Insert func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
531
531
](
532
532
logger slog.Logger ,
533
533
authorizer rbac.Authorizer ,
@@ -554,10 +554,10 @@ func insertWithAction[
554
554
}
555
555
556
556
func deleteQ [
557
- ObjectType rbac.Objecter ,
558
- ArgumentType any ,
559
- Fetch func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
560
- Delete func (ctx context.Context ,arg ArgumentType )error ,
557
+ ObjectType rbac.Objecter ,
558
+ ArgumentType any ,
559
+ Fetch func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
560
+ Delete func (ctx context.Context ,arg ArgumentType )error ,
561
561
](
562
562
logger slog.Logger ,
563
563
authorizer rbac.Authorizer ,
@@ -569,10 +569,10 @@ func deleteQ[
569
569
}
570
570
571
571
func updateWithReturn [
572
- ObjectType rbac.Objecter ,
573
- ArgumentType any ,
574
- Fetch func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
575
- UpdateQuery func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
572
+ ObjectType rbac.Objecter ,
573
+ ArgumentType any ,
574
+ Fetch func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
575
+ UpdateQuery func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
576
576
](
577
577
logger slog.Logger ,
578
578
authorizer rbac.Authorizer ,
@@ -583,10 +583,10 @@ func updateWithReturn[
583
583
}
584
584
585
585
func update [
586
- ObjectType rbac.Objecter ,
587
- ArgumentType any ,
588
- Fetch func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
589
- Exec func (ctx context.Context ,arg ArgumentType )error ,
586
+ ObjectType rbac.Objecter ,
587
+ ArgumentType any ,
588
+ Fetch func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
589
+ Exec func (ctx context.Context ,arg ArgumentType )error ,
590
590
](
591
591
logger slog.Logger ,
592
592
authorizer rbac.Authorizer ,
@@ -604,9 +604,9 @@ func update[
604
604
// user cannot read the resource. This is because the resource details are
605
605
// required to run a proper authorization check.
606
606
func fetchWithAction [
607
- ArgumentType any ,
608
- ObjectType rbac.Objecter ,
609
- DatabaseFunc func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
607
+ ArgumentType any ,
608
+ ObjectType rbac.Objecter ,
609
+ DatabaseFunc func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
610
610
](
611
611
logger slog.Logger ,
612
612
authorizer rbac.Authorizer ,
@@ -637,9 +637,9 @@ func fetchWithAction[
637
637
}
638
638
639
639
func fetch [
640
- ArgumentType any ,
641
- ObjectType rbac.Objecter ,
642
- DatabaseFunc func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
640
+ ArgumentType any ,
641
+ ObjectType rbac.Objecter ,
642
+ DatabaseFunc func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
643
643
](
644
644
logger slog.Logger ,
645
645
authorizer rbac.Authorizer ,
@@ -652,10 +652,10 @@ func fetch[
652
652
// from SQL 'exec' functions which only return an error.
653
653
// See fetchAndQuery for more information.
654
654
func fetchAndExec [
655
- ObjectType rbac.Objecter ,
656
- ArgumentType any ,
657
- Fetch func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
658
- Exec func (ctx context.Context ,arg ArgumentType )error ,
655
+ ObjectType rbac.Objecter ,
656
+ ArgumentType any ,
657
+ Fetch func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
658
+ Exec func (ctx context.Context ,arg ArgumentType )error ,
659
659
](
660
660
logger slog.Logger ,
661
661
authorizer rbac.Authorizer ,
@@ -678,10 +678,10 @@ func fetchAndExec[
678
678
// **before** the query runs. The returns from the fetch are only used to
679
679
// assert rbac. The final return of this function comes from the Query function.
680
680
func fetchAndQuery [
681
- ObjectType rbac.Objecter ,
682
- ArgumentType any ,
683
- Fetch func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
684
- Query func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
681
+ ObjectType rbac.Objecter ,
682
+ ArgumentType any ,
683
+ Fetch func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
684
+ Query func (ctx context.Context ,arg ArgumentType ) (ObjectType ,error ),
685
685
](
686
686
logger slog.Logger ,
687
687
authorizer rbac.Authorizer ,
@@ -715,9 +715,9 @@ func fetchAndQuery[
715
715
// fetchWithPostFilter is like fetch, but works with lists of objects.
716
716
// SQL filters are much more optimal.
717
717
func fetchWithPostFilter [
718
- ArgumentType any ,
719
- ObjectType rbac.Objecter ,
720
- DatabaseFunc func (ctx context.Context ,arg ArgumentType ) ([]ObjectType ,error ),
718
+ ArgumentType any ,
719
+ ObjectType rbac.Objecter ,
720
+ DatabaseFunc func (ctx context.Context ,arg ArgumentType ) ([]ObjectType ,error ),
721
721
](
722
722
authorizer rbac.Authorizer ,
723
723
action policy.Action ,
@@ -3625,10 +3625,10 @@ func (q *querier) InsertPresetParameters(ctx context.Context, arg database.Inser
3625
3625
return q .db .InsertPresetParameters (ctx ,arg )
3626
3626
}
3627
3627
3628
- func (q * querier )InsertPresetPrebuildSchedule (ctx context.Context ,arg database.InsertPresetPrebuildScheduleParams ) ([] database.TemplateVersionPresetPrebuildSchedule ,error ) {
3628
+ func (q * querier )InsertPresetPrebuildSchedule (ctx context.Context ,arg database.InsertPresetPrebuildScheduleParams ) (database.TemplateVersionPresetPrebuildSchedule ,error ) {
3629
3629
err := q .authorizeContext (ctx ,policy .ActionUpdate ,rbac .ResourceTemplate )
3630
3630
if err != nil {
3631
- return nil ,err
3631
+ return database. TemplateVersionPresetPrebuildSchedule {} ,err
3632
3632
}
3633
3633
3634
3634
return q .db .InsertPresetPrebuildSchedule (ctx ,arg )