Skip to content

Commit a6a4bdb

Browse files
committed
fix doc
1 parent 2e280c8 commit a6a4bdb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

docs/guides/engine-plugins.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ No version handshake is required; the proto schema defines the contract.
4141
version: "2"
4242

4343
engines:
44-
- name: mydb
44+
- name: external-db
4545
process:
46-
cmd: sqlc-engine-mydb
46+
cmd: sqlc-engine-external-db
4747
env:
48-
- MYDB_DSN
48+
- EXTERNAL_DB_DSN
4949

5050
sql:
51-
- engine: mydb
51+
- engine: external-db
5252
schema: "schema.sql"
5353
queries: "queries.sql"
5454
codegen:
@@ -73,7 +73,7 @@ For an engine with `process.cmd`, sqlc resolves and runs the plugin as follows:
7373
1. **Command parsing** — `process.cmd` is split on whitespace. The first token is the executable; any further tokens are passed as arguments, and sqlc appends the RPC method name (`parse`) when invoking the plugin.
7474

7575
2. **Executable lookup** — The first token is resolved the same way as in the shell:
76-
- If it contains a path separator (e.g. `/usr/bin/sqlc-engine-mydb` or `./bin/sqlc-engine-mydb`), it is treated as a path. Absolute paths are used as-is; relative paths are taken relative to the **current working directory of the process running sqlc**.
76+
- If it contains a path separator (e.g. `/usr/bin/sqlc-engine-external-db` or `./bin/sqlc-engine-external-db`), it is treated as a path. Absolute paths are used as-is; relative paths are taken relative to the **current working directory of the process running sqlc**.
7777
- If it has no path separator, the executable is looked up in the **PATH** of the process running sqlc. The plugin binary must be on PATH (e.g. after `go install` or adding its directory to PATH) or `process.cmd` must be an absolute path.
7878

7979
3. **Working directory** — The plugin process is started with its working directory set to the **directory containing the sqlc config file**. That directory is used for resolving relative paths inside the plugin, not for resolving `process.cmd` itself.
@@ -91,7 +91,7 @@ import "github.com/sqlc-dev/sqlc/pkg/engine"
9191
9292
func main() {
9393
engine.Run(engine.Handler{
94-
PluginName: "mydb",
94+
PluginName: "external-db",
9595
PluginVersion: "1.0.0",
9696
Parse: handleParse,
9797
})
@@ -160,8 +160,8 @@ Support for sqlc placeholders (`sqlc.arg()`, `sqlc.narg()`, `sqlc.slice()`, `sql
160160
### 3. Build and run
161161

162162
```bash
163-
go build -o sqlc-engine-mydb .
164-
# Ensure sqlc-engine-mydb is on PATH or use an absolute path in process.cmd
163+
go build -o sqlc-engine-external-db .
164+
# Ensure sqlc-engine-external-db is on PATH or use an absolute path in process.cmd
165165
```
166166

167167
## Protocol
@@ -175,7 +175,7 @@ sqlc → stdin (protobuf) → plugin → stdout (protobuf) → sqlc
175175
Invocation:
176176

177177
```bash
178-
sqlc-engine-mydb parse # stdin: ParseRequest, stdout: ParseResponse
178+
sqlc-engine-external-db parse # stdin: ParseRequest, stdout: ParseResponse
179179
```
180180

181181
The definition lives in `protos/engine/engine.proto` (generated Go in `pkg/engine`). After editing the proto, run `make proto-engine-plugin` to regenerate the Go code.
@@ -197,7 +197,7 @@ For each `sql[]` block, `sqlc generate` branches on the configured engine: built
197197
│ 3. Each statement → one codegen query (N helpers) │
198198
└─────────────────────────────────────────────────────────────────┘
199199
200-
sqlc sqlc-engine-mydb
200+
sqlc sqlc-engine-external-db
201201
│──── spawn, args: ["parse"] ──────────────────────────────► │
202202
│──── stdin: ParseRequest{sql=full query.sql, schema_sql|…} ► │
203203
│◄─── stdout: ParseResponse{statements: [stmt1, stmt2, …]} ── │

0 commit comments

Comments
 (0)