Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB API refresh part 2 #5508

Merged
merged 4 commits into from
Dec 13, 2023
Merged

DB API refresh part 2 #5508

merged 4 commits into from
Dec 13, 2023

Conversation

vadimberezniker
Copy link
Member

This PR updates most of the remaining call sites.

Related issues: N/A

This PR updates most of the remaining call sites.
@@ -8,6 +8,7 @@ import (
"errors"
"flag"
"fmt"
"github.com/buildbuddy-io/buildbuddy/server/util/db"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move down

@@ -2,6 +2,7 @@ package execution_service

import (
"context"
"github.com/buildbuddy-io/buildbuddy/server/util/db"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move down

@@ -6,6 +6,7 @@ import (
"crypto/x509"
"encoding/pem"
"fmt"
"github.com/buildbuddy-io/buildbuddy/server/interfaces"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move down

@@ -3,6 +3,7 @@ package iprules
import (
"context"
"flag"
"github.com/buildbuddy-io/buildbuddy/server/util/db"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too

@@ -3,6 +3,7 @@ package usage_test
import (
"context"
"fmt"
"github.com/buildbuddy-io/buildbuddy/server/util/db"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here as well

@@ -3,6 +3,7 @@ package invocationdb
import (
"context"
"errors"
"github.com/buildbuddy-io/buildbuddy/server/util/db"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line, in addition

// foos, err := db.All(rq, &tables.Foo{})
//
// TODO(vadim): check if there are any ScanRows calls that can be converted to ScanAll.
func ScanAll[T any](rq interfaces.DBRawQuery, t *T) ([]*T, error) {
Copy link
Member

@bduffany bduffany Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imo having two funcs ScanRows and ScanAll is a bit confusing since they sound sort of the same - maybe naming this something like CollectRows or ScanToSlice could make sense?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed ScanRows to ScanEach. Hope that differentiates it enough.

@vadimberezniker vadimberezniker enabled auto-merge (squash) December 13, 2023 21:13
@vadimberezniker vadimberezniker merged commit 50bcb1b into master Dec 13, 2023
1 check passed
@vadimberezniker vadimberezniker deleted the db_api_rework_part2 branch December 13, 2023 21:28
@sluongng sluongng mentioned this pull request Dec 15, 2023
sluongng pushed a commit that referenced this pull request Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants