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
34 changes: 33 additions & 1 deletion apps/workspace-engine/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: all build clean proto deps run-server run-client test lint help proto-install
.PHONY: all build clean proto deps run-server run-client test lint help proto-install sqlc-install sqlc-generate sqlc-compile sqlc-verify

# Variables
BINARY := bin/workspace-engine
Expand Down Expand Up @@ -62,6 +62,34 @@ lint:
echo "golangci-lint not installed. Install with: brew install golangci-lint"; \
fi

# sqlc
sqlc-install:
@echo "Installing sqlc..."
$(GO) install github.com/sqlc-dev/sqlc/cmd/sqlc@latest

sqlc-generate:
@echo "Generating typed query code with sqlc..."
@SQLC_BIN=$$(go env GOPATH)/bin/sqlc; \
if [ ! -x "$$SQLC_BIN" ]; then \
echo "sqlc not found. Installing..."; \
$(GO) install github.com/sqlc-dev/sqlc/cmd/sqlc@latest; \
fi; \
$$SQLC_BIN generate -f sqlc.yaml

sqlc-compile:
@echo "Validating sqlc configuration and queries..."
@SQLC_BIN=$$(go env GOPATH)/bin/sqlc; \
if [ ! -x "$$SQLC_BIN" ]; then \
echo "sqlc not found. Installing..."; \
$(GO) install github.com/sqlc-dev/sqlc/cmd/sqlc@latest; \
fi; \
$$SQLC_BIN compile -f sqlc.yaml

sqlc-verify:
@$(MAKE) sqlc-compile
@echo "sqlc verify uses sqlc Cloud project settings."
@echo "Run '$$(go env GOPATH)/bin/sqlc verify -f sqlc.yaml' after configuring sqlc Cloud."

# Format code
fmt:
@echo "Formatting code..."
Expand Down Expand Up @@ -100,6 +128,10 @@ help:
@echo " make test - Run tests"
@echo " make test-coverage - Run tests with coverage report"
@echo " make lint - Run linter"
@echo " make sqlc-install - Install sqlc CLI"
@echo " make sqlc-generate - Generate typed Go query code from sqlc files"
@echo " make sqlc-compile - Validate sqlc config, schema, and queries"
@echo " make sqlc-verify - Run local compile checks and show sqlc Cloud verify hint"
@echo " make fmt - Format code"
@echo " make clean - Clean build artifacts"
@echo " make install-tools - Install development tools"
Expand Down
13 changes: 13 additions & 0 deletions apps/workspace-engine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,25 @@ make dev # Run without building
make test # Run tests
make test-coverage # Run tests with coverage report
make lint # Run linter
make sqlc-generate # Generate typed Go query code from sqlc files
make sqlc-compile # Validate sqlc config, schema, and queries
make sqlc-verify # Run local compile checks and show sqlc Cloud verify hint
make fmt # Format code
make clean # Clean build artifacts
make install-tools # Install development tools
make help # Show help message
```

### SQLC typed queries

`workspace-engine` now includes a starter `sqlc` setup under `./sqlc`.

```bash
make sqlc-generate
```

Generated code is written to `pkg/db/sqlcgen`.

## API Overview

The Workspace Engine provides six main gRPC endpoints:
Expand Down
9 changes: 9 additions & 0 deletions apps/workspace-engine/pkg/db/sqlcgen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Generated sqlc package

This directory contains generated code from `apps/workspace-engine/sqlc.yaml`.

Regenerate with:

```bash
make sqlc-generate
```
32 changes: 32 additions & 0 deletions apps/workspace-engine/pkg/db/sqlcgen/db.go

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

66 changes: 66 additions & 0 deletions apps/workspace-engine/pkg/db/sqlcgen/models.go

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

22 changes: 22 additions & 0 deletions apps/workspace-engine/pkg/db/sqlcgen/querier.go

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

Loading
Loading