-
Notifications
You must be signed in to change notification settings - Fork 600
refactor: move db queries into the owner service #4801
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,41 @@ | ||
| build --color=yes | ||
| build --show_timestamps | ||
| # ============================================================ | ||
| # Common settings | ||
| # ============================================================ | ||
| common --color=yes | ||
| common --show_timestamps | ||
|
|
||
| # ============================================================ | ||
| # Caching - Critical for performance | ||
| # ============================================================ | ||
| # Persist external repository downloads (Go modules, etc.) | ||
| common --repository_cache=~/.cache/bazel-repo | ||
| common --experimental_repository_cache_hardlinks | ||
|
|
||
| # Persist build artifacts across clean/workspaces | ||
| common --disk_cache=~/.cache/bazel-disk | ||
|
|
||
| # ============================================================ | ||
| # Build & Test performance | ||
| # ============================================================ | ||
| # Increase action parallelism | ||
| build --jobs=auto | ||
| test --jobs=auto | ||
|
|
||
| # Keep going on errors to maximize cache population | ||
| build --keep_going | ||
| test --keep_going | ||
|
|
||
| # Reduce sandbox overhead for trusted builds (comment out for hermetic CI) | ||
| build --spawn_strategy=local | ||
| build --strategy=GoCompilePkg=local | ||
| test --spawn_strategy=local | ||
| test --strategy=GoCompilePkg=local | ||
|
|
||
| # ============================================================ | ||
| # Test settings | ||
| # ============================================================ | ||
| test --test_output=errors | ||
| test --test_summary=terse | ||
| test --local_test_jobs=auto | ||
|
|
||
|
|
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "db", | ||
| srcs = [ | ||
| "db.go", | ||
| "deployment.sql_generated.go", | ||
| "generate.go", | ||
| "instances.sql_generated.go", | ||
| "models_generated.go", | ||
| "querier_generated.go", | ||
| ], | ||
| importpath = "github.com/unkeyed/unkey/svc/sentinel/db", | ||
| visibility = ["//svc/sentinel:__subpackages__"], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package db | ||
|
|
||
| import ( | ||
| "context" | ||
| "database/sql" | ||
| ) | ||
|
|
||
| // DBTX is an interface that abstracts database operations for both | ||
| // direct connections and transactions. | ||
| type DBTX interface { | ||
| ExecContext(context.Context, string, ...interface{}) (sql.Result, error) | ||
| PrepareContext(context.Context, string) (*sql.Stmt, error) | ||
| QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) | ||
| QueryRowContext(context.Context, string, ...interface{}) *sql.Row | ||
| } | ||
|
|
||
| // Queries provides all query methods. | ||
| type Queries struct{} | ||
|
|
||
| // Query is the global query instance. | ||
| var Query = &Queries{} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| package db | ||
|
|
||
| //go:generate go tool sqlc generate | ||
| //go:generate rm delete_me.go |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore this, it's from a previous PR, jj is hard lol