1- > 🚨
2- >
3- > sqlc is ** new** and under rapid development.
4- >
5- > The code it generates is correct and safe for production use, but there is
6- > currently no guarantee of stability or backwards-compatibility of the command
7- > line interface, configuration file format or generated code.
8- >
9- > 🚨
10-
111# sqlc: A SQL Compiler
122
133> And lo, the Great One looked down upon the people and proclaimed:
@@ -232,6 +222,7 @@ Your favorite PostgreSQL / Go features are supported:
232222 - [ Query annotations] ( ./docs/annotations.md )
233223 - [ Transactions] ( ./docs/transactions.md )
234224 - [ Prepared queries] ( ./docs/prepared_query.md )
225+ - [ Named parameters] ( ./docs/named_parameters.md )
235226 - [ SELECT] ( ./docs/query_one.md )
236227 - [ NULL] ( ./docs/null.md )
237228 - [ COUNT] ( ./docs/query_count.md )
@@ -265,7 +256,7 @@ Available Commands:
265256 compile Statically check SQL for syntax and type errors
266257 generate Generate Go code from SQL
267258 help Help about any command
268- init Create an empty sqlc.json settings file
259+ init Create an empty sqlc.yaml settings file
269260 version Print the sqlc version number
270261
271262Flags:
@@ -276,24 +267,19 @@ Use "sqlc [command] --help" for more information about a command.
276267
277268## Settings
278269
279- The ` sqlc ` tool is configured via a ` sqlc.json ` file. This file must be
270+ The ` sqlc ` tool is configured via a ` sqlc.yaml ` file. This file must be
280271in the directory where the ` sqlc ` command is run.
281272
282- ``` json
283- {
284- "version" : " 1" ,
285- "packages" : [
286- {
287- "name" : " db" ,
288- "emit_json_tags" : true ,
289- "emit_prepared_queries" : false ,
290- "emit_interface" : true ,
291- "path" : " internal/db" ,
292- "queries" : " ./sql/query/" ,
293- "schema" : " ./sql/schema/"
294- }
295- ]
296- }
273+ ``` yaml
274+ version : " 1"
275+ packages :
276+ - name : " db" ,
277+ emit_json_tags : true
278+ emit_prepared_queries : false
279+ emit_interface : true
280+ path : " internal/db"
281+ queries : " ./sql/query/"
282+ schema : " ./sql/schema/"
297283` ` `
298284
299285Each package document has the following keys:
@@ -324,17 +310,12 @@ If a different Go package for UUIDs is required, specify the package in the
324310` overrides` array. In this case, I'm going to use the `github.com/gofrs/uuid`
325311instead.
326312
327- ```
328- {
329- "version": "1",
330- "packages": [...],
331- "overrides": [
332- {
333- "go_type": "github.com/gofrs/uuid.UUID",
334- "db_type": "uuid"
335- }
336- ]
337- }
313+ ` ` ` yaml
314+ version: "1"
315+ packages: [...]
316+ overrides:
317+ - go_type: "github.com/gofrs/uuid.UUID"
318+ db_type: "uuid"
338319` ` `
339320
340321Each override document has the following keys :
@@ -354,36 +335,24 @@ This may be configured by specifying the `column` property in the override defin
354335should be of the form `table.column` buy you may be even more specify by specifying `schema.table.column`
355336or `catalog.schema.table.column`.
356337
357- ```
358- {
359- "version": "1",
360- "packages": [...],
361- "overrides": [
362- {
363- "column": "authors.id",
364- "go_type": "github.com/segmentio/ksuid.KSUID"
365- }
366- ]
367- }
338+ ` ` ` yaml
339+ version: "1"
340+ packages: [...]
341+ overrides:
342+ - column: "authors.id"
343+ go_type: "github.com/segmentio/ksuid.KSUID"
368344` ` `
369345
370346# ## Package Level Overrides
371347
372348Overrides can be configured globally, as demonstrated in the previous sections, or they can be configured on a per-package which
373349scopes the override behavior to just a single package :
374350
351+ ` ` ` yaml
352+ version: "1"
353+ packages:
354+ - overrides: [...]
375355` ` `
376- {
377- "version": "1",
378- "packages": [
379- {
380- ...
381- "overrides": [...]
382- }
383- ],
384- }
385- ```
386-
387356
388357# ## Renaming Struct Fields
389358
@@ -401,14 +370,11 @@ If you're not happy with a field's generated name, use the `rename` dictionary
401370to pick a new name. The keys are column names and the values are the struct
402371field name to use.
403372
404- ``` json
405- {
406- "version" : " 1" ,
407- "packages" : [... ],
408- "rename" : {
409- "spotify_url" : " SpotifyURL"
410- }
411- }
373+ ```yaml
374+ version: "1"
375+ packages: [...]
376+ rename:
377+ spotify_url: "SpotifyURL"
412378```
413379
414380## Downloads
@@ -420,7 +386,8 @@ Each commit is deployed to the [`devel` channel on Equinox](https://dl.equinox.i
420386## Other Databases and Languages
421387
422388sqlc currently only supports PostgreSQL / Go. MySQL support has been merged,
423- but it's marked as experimental. SQLite and TypeScript support are planned.
389+ but it's marked as experimental. SQLite, TypeScript, and Kotlin support are
390+ planned.
424391
425392| Language | PostgreSQL | MySQL | SQLite |
426393| ------------ | :----------------:| :----------------:| :----------------:|
@@ -429,6 +396,21 @@ but it's marked as experimental. SQLite and TypeScript support are planned.
429396
430397If you'd like to add another database or language, we'd welcome a contribution.
431398
399+ ## Sponsors
400+
401+ sqlc development is funded by our generous sponsors.
402+
403+ - Companies
404+ - [ Meter] ( https://meter.com )
405+ - [ ngrok] ( https://ngrok.com )
406+ - Individuals
407+ - [ CyberAx] ( https://github.com/Cyberax )
408+
409+ If you use sqlc at your company, please consider [ becoming a
410+ sponsor] ( https://github.com/sponsors/kyleconroy ) today.
411+
412+ Sponsors receive priority support via the sqlc Slack organization.
413+
432414## Acknowledgements
433415
434416sqlc was inspired by [ PugSQL] ( https://pugsql.org/ ) and
0 commit comments