Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 40 additions & 2 deletions .bazelrc
Copy link
Collaborator Author

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

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


2 changes: 1 addition & 1 deletion Makefile
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

same here

Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ generate: generate-sql ## Generate code from protobuf and other sources
.PHONY: test
test: ## Run tests with bazel
docker compose -f ./dev/docker-compose.yaml up -d mysql clickhouse s3 kafka restate ctrl --wait
bazel test //... --test_output=errors
bazel test //...
make clean-docker-test

.PHONY: clean-docker-test
Expand Down
15 changes: 15 additions & 0 deletions svc/sentinel/db/BUILD.bazel
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__"],
)
21 changes: 21 additions & 0 deletions svc/sentinel/db/db.go
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{}
49 changes: 49 additions & 0 deletions svc/sentinel/db/deployment.sql_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions svc/sentinel/db/generate.go
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
64 changes: 64 additions & 0 deletions svc/sentinel/db/instances.sql_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

187 changes: 187 additions & 0 deletions svc/sentinel/db/models_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading