|
1 | 1 | > 🚨 |
2 | 2 | > |
3 | | -> DinoSQL is **very new** and under rapid development. |
| 3 | +> sqlc is **very new** and under rapid development. |
4 | 4 | > |
5 | 5 | > The code it generates is correct and safe for production use, but |
6 | 6 | > there is currently no garantee of stability or backwards-compatibility of |
7 | 7 | > the command line interface, configuration file format or generated code. |
8 | 8 | > |
9 | 9 | > 🚨 |
10 | 10 |
|
11 | | -# Dino: A SQL Compiler |
| 11 | +# sqlc: A SQL Compiler |
12 | 12 |
|
13 | 13 | > And lo, the Great One looked down upon the people and proclaimed: |
14 | 14 | > |
15 | 15 | > "SQL is actually pretty great" |
16 | 16 |
|
17 | | -DinoSQL generates **fully-type safe idiomatic Go code** from SQL. Here's how it works: |
| 17 | +sqlc generates **fully-type safe idiomatic Go code** from SQL. Here's how it works: |
18 | 18 |
|
19 | 19 | 1. You write SQL queries |
20 | | -1. You run the DinoSQL tool to generate Go code that presents type-safe interfaces to those queries |
21 | | -1. You write application code that calls the methods DinoSQL generated. |
| 20 | +1. You run sqlc to generate Go code that presents type-safe interfaces to those queries |
| 21 | +1. You write application code that calls the methods sqlc generated. |
22 | 22 |
|
23 | 23 | Seriously, it's that easy. You don't have to write any boilerplate SQL querying code ever again. |
24 | 24 |
|
25 | 25 | ## Preventing Errors |
26 | | -But DinoSQL doesn't just make you more productive by generating boilerplate for you. |
27 | | -DinoSQL **also prevents entire classes of common errors in SQL code**. Have you ever: |
| 26 | +But sqlc doesn't just make you more productive by generating boilerplate for you. |
| 27 | +sqlc **also prevents entire classes of common errors in SQL code**. Have you ever: |
28 | 28 |
|
29 | 29 | - Mixed up the order of the arguments when invoking the query so they didn't match up with the SQL text |
30 | 30 | - Updated the name of a column in one query both not another |
31 | 31 | - Mistyped the name of a column in a query |
32 | 32 | - Changed the number of arguments in a query but forgot to pass the additional values |
33 | 33 | - Changed the type of a column but forgot to change the type in your code? |
34 | 34 |
|
35 | | -All of these errors are *impossible* with DinoSQL. Wait, what? How? |
| 35 | +All of these errors are *impossible* with sqlc. Wait, what? How? |
36 | 36 |
|
37 | | -DinoSQL parses your all of your queries and the DDL (e.g. `CREATE TABLE`) statements during the code generation processes |
| 37 | +sqlc parses your all of your queries and the DDL (e.g. `CREATE TABLE`) statements during the code generation processes |
38 | 38 | so that it knows the names and types of every column in your tables and every expression in your queries. |
39 | | -If any of them do not match, DinoSQL *will fail to compile your queries*, preventing entire classes of runtime problems |
| 39 | +If any of them do not match, sqlc *will fail to compile your queries*, preventing entire classes of runtime problems |
40 | 40 | at compile time. |
41 | 41 |
|
42 | | -Likewise, the methods that DinoSQL generates for you have a stricty arity and correct Go type definitions that match your columns. So if you |
| 42 | +Likewise, the methods that sqlc generates for you have a stricty arity and correct Go type definitions that match your columns. So if you |
43 | 43 | change a query's arguments or a column's type but don't update your code, it will fail to compile. |
44 | 44 |
|
45 | 45 | ## Getting Started |
46 | 46 | Okay, enough hype, let's see it in action. |
47 | 47 |
|
48 | | -First you pass the following SQL to `dinosql generate`: |
| 48 | +First you pass the following SQL to `sqlc generate`: |
49 | 49 |
|
50 | 50 | ```sql |
51 | 51 | CREATE TABLE authors ( |
@@ -105,7 +105,7 @@ if err != nil { |
105 | 105 | fmt.Println(reflect.DeepEqual(insertedAuthor, fetchedAuthor)) |
106 | 106 | ``` |
107 | 107 |
|
108 | | -To make that possible, DinoSQL generates readable, **idiomatic** Go code that you otherwise would have had to write yourself. Take a look: |
| 108 | +To make that possible, sqlc generates readable, **idiomatic** Go code that you otherwise would have had to write yourself. Take a look: |
109 | 109 |
|
110 | 110 | ```go |
111 | 111 | package db |
@@ -240,31 +240,31 @@ Your favorite PostgreSQL / Go features are supported: |
240 | 240 | - [Goose migrations](./examples/goose.md) |
241 | 241 |
|
242 | 242 | A full, end-to-end example can be found in the sample |
243 | | -[`ondeck`](./internal/dinosql/testdata/ondeck) package. |
| 243 | +[`ondeck`](./internal/sqlc/testdata/ondeck) package. |
244 | 244 |
|
245 | 245 | ## Usage |
246 | 246 |
|
247 | 247 | ``` |
248 | 248 | Usage: |
249 | | - dinosql [command] |
| 249 | + sqlc [command] |
250 | 250 |
|
251 | 251 | Available Commands: |
252 | 252 | compile Statically check SQL for syntax and type errors |
253 | 253 | generate Generate Go code from SQL |
254 | 254 | help Help about any command |
255 | | - init Create an empty dinosql.json settings file |
256 | | - version Print the DinoSQL version number |
| 255 | + init Create an empty sqlc.json settings file |
| 256 | + version Print the sqlc version number |
257 | 257 |
|
258 | 258 | Flags: |
259 | | - -h, --help help for dinosql |
| 259 | + -h, --help help for sqlc |
260 | 260 |
|
261 | | -Use "dinosql [command] --help" for more information about a command. |
| 261 | +Use "sqlc [command] --help" for more information about a command. |
262 | 262 | ``` |
263 | 263 |
|
264 | 264 | ## Settings |
265 | 265 |
|
266 | | -The `dinosql` tool is configured via a `dinosql.json` file. This file must be |
267 | | -in the directory where the `dinosql` command is run. |
| 266 | +The `sqlc` tool is configured via a `sqlc.json` file. This file must be |
| 267 | +in the directory where the `sqlc` command is run. |
268 | 268 |
|
269 | 269 | ```json |
270 | 270 | { |
@@ -297,19 +297,19 @@ Each package document has the following keys: |
297 | 297 |
|
298 | 298 | ## Downloads |
299 | 299 |
|
300 | | -Each commit is deployed to the [`devel` channel on Equinox](https://dl.equinox.io/dinosql/dinosql/devel): |
301 | | -- [Linux](https://bin.equinox.io/c/jUfda88XW4i/dinosql-devel-linux-amd64.tgz) |
302 | | -- [macOS](https://bin.equinox.io/c/jUfda88XW4i/dinosql-devel-darwin-amd64.zip) |
| 300 | +Each commit is deployed to the [`devel` channel on Equinox](https://dl.equinox.io/sqlc/sqlc/devel): |
| 301 | +- [Linux](https://bin.equinox.io/c/jUfda88XW4i/sqlc-devel-linux-amd64.tgz) |
| 302 | +- [macOS](https://bin.equinox.io/c/jUfda88XW4i/sqlc-devel-darwin-amd64.zip) |
303 | 303 |
|
304 | 304 | ## Other Database Engines |
305 | 305 |
|
306 | | -DinoSQL currently only supports PostgreSQL. If you'd like to support another database, we'd welcome a contribution. |
| 306 | +sqlc currently only supports PostgreSQL. If you'd like to support another database, we'd welcome a contribution. |
307 | 307 |
|
308 | 308 | ## Other Language Backends |
309 | 309 |
|
310 | | -DinoSQL currently only generates Go code, but if you'd like to build another language backend, we'd welcome a contribution. |
| 310 | +sqlc currently only generates Go code, but if you'd like to build another language backend, we'd welcome a contribution. |
311 | 311 |
|
312 | 312 | ## Acknowledgements |
313 | 313 |
|
314 | | -DinoSQL was inspired by [PugSQL](https://pugsql.org/) and |
| 314 | +sqlc was inspired by [PugSQL](https://pugsql.org/) and |
315 | 315 | [HugSQL](https://www.hugsql.org/). |
0 commit comments