Skip to content
Merged
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
12 changes: 5 additions & 7 deletions docs/howto/ci-cd.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ database schema. Learn more about uploading projects [here](push.md)

## General setup

Install `sqlc` using the [suggested instructions](../overview/install).
Install `sqlc` using the [suggested instructions](../overview/install.md).

Create three steps in your pipeline for `sqlc diff`, `sqlc vet`, and `sqlc
verify`. Run `sqlc push` after merge on your `main` branch.
Expand Down Expand Up @@ -98,9 +98,8 @@ jobs:

### push

```{note}
Pushing a project is powered by [sqlc Cloud](https://dashboard.sqlc.dev). Sign up for [free](https://dashboard.sqlc.dev) today.
```
> [!NOTE]
> Pushing a project is powered by [sqlc Cloud](https://dashboard.sqlc.dev). Sign up for [free](https://dashboard.sqlc.dev) today.

The following GitHub Workflow configuration runs [sqlc push](push.md) on
every push to `main`. Create an auth token via the
Expand All @@ -125,9 +124,8 @@ jobs:

### verify

```{note}
Verify database migrations is powered by [sqlc Cloud](https://dashboard.sqlc.dev). Sign up for [free](https://dashboard.sqlc.dev) today.
```
> [!NOTE]
> Verify database migrations is powered by [sqlc Cloud](https://dashboard.sqlc.dev). Sign up for [free](https://dashboard.sqlc.dev) today.

```yaml
name: sqlc
Expand Down
2 changes: 1 addition & 1 deletion docs/howto/embedding.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Embedding structs
# Embedding structs

Embedding allows you to reuse existing model structs in more queries, resulting
in less manual serialization work. First, imagine we have the following schema
Expand Down
4 changes: 2 additions & 2 deletions docs/howto/managed-databases.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ sql:

With managed databases configured, `sqlc vet` will automatically create a hosted ephemeral database with your
schema and use that database when running lint rules that require a
database connection, e.g. any [rule relying on `EXPLAIN ...` output](vet.md#rules-using-explain-output).
database connection, e.g. any [rule relying on `EXPLAIN ...` output](vet.md#rules-using-explain--output).

If you don't yet have any vet rules, the [built-in sqlc/db-prepare rule](vet.md#sqlc-db-prepare)
If you don't yet have any vet rules, the [built-in sqlc/db-prepare rule](vet.md#sqlcdb-prepare)
is a good place to start. It prepares each of your queries against the database
to ensure the query is valid. Here's a minimal working configuration:

Expand Down
5 changes: 2 additions & 3 deletions docs/howto/named_parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ type UpdateAuthorNameParams struct {
If the `sqlc.arg()` syntax is too verbose for your taste, you can use the `@`
operator as a shortcut.

```{note}
The `@` operator as a shortcut for `sqlc.arg()` is not supported in MySQL.
```
> [!NOTE]
> The `@` operator as a shortcut for `sqlc.arg()` is not supported in MySQL.

```sql
-- name: UpsertAuthorName :one
Expand Down
30 changes: 13 additions & 17 deletions docs/howto/overrides.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Overriding types

:::{note}
Type overrides and field renaming are only fully-supported for Go.
:::
> [!NOTE]
> Type overrides and field renaming are only fully-supported for Go.

In many cases it's useful to tell `sqlc` explicitly what Go type you want it to
use for a query input or output. For instance, by default when you use
Expand Down Expand Up @@ -39,11 +38,10 @@ sql:
go_type: "time.Time"
```

:::{tip}
A single `db_type` override configuration applies to either nullable or non-nullable
columns, but not both. If you want the same Go type to override regardless of
nullability, you'll need to configure two overrides: one with `nullable: true` and one without.
:::
> [!TIP]
> A single `db_type` override configuration applies to either nullable or non-nullable
> columns, but not both. If you want the same Go type to override regardless of
> nullability, you'll need to configure two overrides: one with `nullable: true` and one without.

## The `overrides` list

Expand All @@ -54,7 +52,7 @@ Each element in the `overrides` list has the following keys:
- `column`:
- A column name to override. The value should be of the form `table.column` but you can also specify `schema.table.column` or `catalog.schema.table.column`. `column` and `db_type` are mutually exclusive.
- `go_type`:
- The fully-qualified name of a Go type to use in generated code. This is usually a string but can also be [a map](#the-go-type-map) for more complex configurations.
- The fully-qualified name of a Go type to use in generated code. This is usually a string but can also be [a map](#the-go_type-map) for more complex configurations.
- `go_struct_tag`:
- A reflect-style struct tag to use in generated code, e.g. `a:"b" x:"y,z"`.
If you want `json` or `db` tags for all fields, configure `emit_json_tags` or `emit_db_tags` instead.
Expand All @@ -68,15 +66,13 @@ Each element in the `overrides` list has the following keys:
Note that this only applies to `db_type` overrides and has no effect on `column` overrides.
Defaults to `false`.

:::{tip}
A single `db_type` override configuration applies to either nullable or non-nullable
columns, but not both. If you want the same Go type to override regardless of nullability, you'll
need to configure two overrides: one with `nullable: true` and one without.
:::
> [!TIP]
> A single `db_type` override configuration applies to either nullable or non-nullable
> columns, but not both. If you want the same Go type to override regardless of nullability, you'll
> need to configure two overrides: one with `nullable: true` and one without.

:::{note}
When generating code, `column` override configurations take precedence over `db_type` configurations.
:::
> [!NOTE]
> When generating code, `column` override configurations take precedence over `db_type` configurations.

### The `go_type` map

Expand Down
5 changes: 2 additions & 3 deletions docs/howto/push.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# `push` - Uploading projects

```{note}
`push` is powered by [sqlc Cloud](https://dashboard.sqlc.dev). Sign up for [free](https://dashboard.sqlc.dev) today.
```
> [!NOTE]
> `push` is powered by [sqlc Cloud](https://dashboard.sqlc.dev). Sign up for [free](https://dashboard.sqlc.dev) today.

*Added in v1.24.0*

Expand Down
4 changes: 2 additions & 2 deletions docs/howto/vet.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

`sqlc vet` runs queries through a set of lint rules.

Rules are defined in the `sqlc` [configuration](../reference/config) file. They
Rules are defined in the `sqlc` [configuration](../reference/config.md) file. They
consist of a name, message, and a [Common Expression Language
(CEL)](https://github.com/google/cel-spec) expression. Expressions are evaluated
using [cel-go](https://github.com/google/cel-go). If an expression evaluates to
Expand Down Expand Up @@ -48,7 +48,7 @@ each CEL expression has access to the output from running `EXPLAIN ...` on your
via the `postgresql.explain` and `mysql.explain` variables.
This output is quite complex and depends on the structure of your query but sqlc attempts
to parse and provide as much information as it can. See
[Rules using `EXPLAIN ...` output](#rules-using-explain-output) for more information.
[Rules using `EXPLAIN ...` output](#rules-using-explain--output) for more information.

Here are a few example rules just using the basic configuration and query information available
to the CEL expression environment. While these examples are simplistic, they give you a flavor
Expand Down
8 changes: 4 additions & 4 deletions docs/reference/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ Like upload, `push` should be run when you tag a release of your application. We

#### MySQL support in `createdb`

The `createdb` command, added in the last release, now supports MySQL. If you have a cloud project configured, you can use `sqlc createdb` to spin up a new ephemeral database with your schema and print its connection string to standard output. This is useful for integrating with other tools. Read more in the [managed databases](../howto/managed-databases.md#with-other-tools) documentation.
The `createdb` command, added in the last release, now supports MySQL. If you have a cloud project configured, you can use `sqlc createdb` to spin up a new ephemeral database with your schema and print its connection string to standard output. This is useful for integrating with other tools. Read more in the [managed databases](../howto/managed-databases.md) documentation.

#### Plugin interface refactor

Expand Down Expand Up @@ -628,7 +628,7 @@ When you have a cloud project configured, you can use the new `sqlc createdb`
command to spin up a new ephemeral database with your schema and print its
connection string to standard output. This is useful for integrating with other
tools. Read more in the [managed
databases](../howto/managed-databases.md#with-other-tools) documentation.
databases](../howto/managed-databases.md) documentation.

#### Support for pgvector

Expand Down Expand Up @@ -833,7 +833,7 @@ full list.

#### Plugin access to environment variables

If you're authoring a [sqlc plugin](../guides/plugins.html), you can now configure
If you're authoring a [sqlc plugin](../guides/plugins.md), you can now configure
sqlc to pass your plugin the values of specific environment variables.

For example, if your plugin
Expand Down Expand Up @@ -1254,7 +1254,7 @@ rules:
database server. We'll expand this functionality over time, but for now it
powers the `sqlc/db-prepare` built-in rule.

When a [database](config.html#database) is configured, the
When a [database](config.md#database) is configured, the
`sqlc/db-preapre` rule will attempt to prepare each of your
queries against the connected database and report any failures.

Expand Down
4 changes: 2 additions & 2 deletions docs/reference/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ See [Overriding types](../howto/overrides.md) for an in-depth guide to using typ

#### kotlin

> Removed in v1.17.0 and replaced by the [sqlc-gen-kotlin](https://github.com/sqlc-dev/sqlc-gen-kotlin) plugin. Follow the [migration guide](../guides/migrating-to-sqlc-gen-kotlin) to switch.
> Removed in v1.17.0 and replaced by the [sqlc-gen-kotlin](https://github.com/sqlc-dev/sqlc-gen-kotlin) plugin. Follow the [migration guide](../guides/migrating-to-sqlc-gen-kotlin.md) to switch.

- `package`:
- The package name to use for the generated code.
Expand All @@ -215,7 +215,7 @@ See [Overriding types](../howto/overrides.md) for an in-depth guide to using typ

#### python

> Removed in v1.17.0 and replaced by the [sqlc-gen-python](https://github.com/sqlc-dev/sqlc-gen-python) plugin. Follow the [migration guide](../guides/migrating-to-sqlc-gen-python) to switch.
> Removed in v1.17.0 and replaced by the [sqlc-gen-python](https://github.com/sqlc-dev/sqlc-gen-python) plugin. Follow the [migration guide](../guides/migrating-to-sqlc-gen-python.md) to switch.

- `package`:
- The package name to use for the generated code.
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ FROM authors
WHERE lower(name) = ?;
```

See more examples in [Naming parameters](../howto/named_parameters).
See more examples in [Naming parameters](../howto/named_parameters.md).

## `sqlc.embed`

Expand Down Expand Up @@ -72,7 +72,7 @@ func (q *Queries) GetStudentAndScore(ctx context.Context, id int64) (GetStudentA
}
```

See a full example in [Embedding structs](../howto/embedding).
See a full example in [Embedding structs](../howto/embedding.md).

## `sqlc.narg`

Expand All @@ -92,7 +92,7 @@ FROM authors
WHERE LOWER(name) = ?;
```

See more examples in [Naming parameters](../howto/named_parameters).
See more examples in [Naming parameters](../howto/named_parameters.md).

## `sqlc.slice`

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ require (
github.com/sqlc-dev/zetajones v0.1.0
github.com/tetratelabs/wazero v1.12.0
github.com/xeipuuv/gojsonschema v1.2.0
github.com/yuin/goldmark v1.8.5
golang.org/x/sync v0.22.0
google.golang.org/grpc v1.83.1
google.golang.org/protobuf v1.36.12
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHo
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
github.com/yuin/goldmark v1.8.5 h1:r6N5afV5qj/5S4UTch8agZHJ8UxNCMwX7WjkkJam2NA=
github.com/yuin/goldmark v1.8.5/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/otel v1.44.0 h1:JjwHmHpA4iZ3wBxluu2fbbE7j4kqlE8jXyAyPXH7HqU=
Expand Down
Loading
Loading