Skip to content

Commit 6d0425b

Browse files
committed
Update usage
1 parent 2c10512 commit 6d0425b

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

README.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@ The plugin supports the following configuration options:
2727

2828
## Usage
2929

30-
### 1. Configure sqlc.yaml
30+
### 1. Install the plugin
31+
To use this plugin, you need to install it first. You can do this by running the following command:
32+
33+
```shell
34+
go install github.com/tomtwinkle/sqlc-plugin-bulk-go@latest
35+
```
36+
37+
### 2. Configure sqlc.yaml
3138

3239
Add the plugin to your sqlc configuration:
3340

@@ -36,28 +43,34 @@ version: "2"
3643
plugins:
3744
- name: bulkinsert
3845
process:
39-
cmd: "go run github.com/tomtwinkle/sqlc-plugin-bulk-go"
40-
options:
41-
package: "db" # Replace with your database package name
42-
46+
cmd: "sqlc-plugin-bulk-go"
4347
sql:
4448
- schema: "path/to/schema.sql"
4549
queries: "path/to/query.sql"
4650
engine: "postgresql" # or "mysql"
4751
codegen:
4852
- plugin: bulkinsert
4953
out: "path/to/output"
54+
options:
55+
package: "db" # Replace with your database package name
56+
- schema: "path/to/schema.sql"
57+
queries: "path/to/query.sql"
58+
engine: "postgresql" # or "mysql"
59+
gen:
60+
go:
61+
# sqlc-gen-go is the default codegen for sqlc
62+
# https://github.com/sqlc-dev/sqlc-gen-go
5063
```
5164

52-
### 2. Generate code
65+
### 3. Generate code
5366

5467
Run sqlc to generate your code:
5568

5669
```bash
5770
sqlc generate
5871
```
5972

60-
### 3. Use the generated bulk insert functions
73+
### 4. Use the generated bulk insert functions
6174

6275
For each INSERT query in your sqlc configuration, a corresponding bulk insert function will be generated. For example, if you have a query named `CreateUser`, a `BulkCreateUser` function will be generated.
6376

0 commit comments

Comments
 (0)