Skip to content

Commit

Permalink
Docs: can finally get rid of bad link warnings with docusaurus 3
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindberg committed May 5, 2024
1 parent 1ec9095 commit 91b8a43
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 37 deletions.
10 changes: 5 additions & 5 deletions site-in/customization/customize-selected-relations.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Maybe you're generating code for just a part of the system, not the whole thing.
Typo has a mechanism by which you can choose which relations to generate code for.

among the arguments to `generateFromDb` is `selector`, which by default picks all relations except those in the postgres schemas.
See [Selector](customization/selector.md)
See [Selector](selector.md)

```scala
import typo.*
Expand All @@ -20,11 +20,11 @@ generateFromDb(options, selector = Selector.ExcludePostgresInternal)

## Transitive relations

So in Typo we say that relations have dependencies, see [flow typing](type-safety/type-flow.md).
So in Typo we say that relations have dependencies, see [flow typing](../type-safety/type-flow.md).

Say you have some [sql files](what-is/sql-is-king.md) and have chosen some relations, and some of those have dependencies on other relations.
Say you have some [sql files](../what-is/sql-is-king.md) and have chosen some relations, and some of those have dependencies on other relations.
Typo can optionally generate code for these dependencies as well.

If you want that, you can [customize](customization/overview.md) Typo and set the `keepDependencies` parameter to `true` to generate code for those dependencies as well.
If you want that, you can [customize](overview.md) Typo and set the `keepDependencies` parameter to `true` to generate code for those dependencies as well.

`keepDependencies` is set to `false` by default. If it's left at `false`, you'll only see the [primary key types](type-safety/id-types.md) for those relations
`keepDependencies` is set to `false` by default. If it's left at `false`, you'll only see the [primary key types](../type-safety/id-types.md) for those relations
4 changes: 2 additions & 2 deletions site-in/customization/customize-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ title: Customize column types
---

Note that use of this feature is in general **discouraged**,
see warning in [user-selected type](type-safety/user-selected-types.md).
see warning in [user-selected type](../type-safety/user-selected-types.md).

If you're not happy with the types PostgreSQL and Typo has ended up with for a given column, you can override it.

This is referred to within Typo as a [user-selected type](type-safety/user-selected-types.md).
This is referred to within Typo as a [user-selected type](../type-safety/user-selected-types.md).



Expand Down
10 changes: 5 additions & 5 deletions site-in/customization/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ val options = Options(
| `nullabilityOverride` | Defines nullability overrides for specific columns See section below. |
| `generateMockRepos` | Specifies which repositories to generate mock versions for (default is all). |
| `enableFieldValue` | Controls whether to enable `FieldValue` code generation for specific repositories (default is disabled). |
| `enableStreamingInserts` | Controls whether to enable [streaming inserts](other-features/streaming-inserts.md) |
| `enableTestInserts` | Controls whether to enable [test inserts](other-features/testing-with-random-values.md) for specific repositories (default is none). |
| `enablePrimaryKeyType` | Controls whether to enable [primary key types](type-safety/id-types.md) for specific repositories (default is all). |
| `enableStreamingInserts` | Controls whether to enable [streaming inserts](../other-features/streaming-inserts.md) |
| `enableTestInserts` | Controls whether to enable [test inserts](../other-features/testing-with-random-values.md) for specific repositories (default is none). |
| `enablePrimaryKeyType` | Controls whether to enable [primary key types](../type-safety/id-types.md) for specific repositories (default is all). |
| `readonlyRepo` | Specifies whether to generate read-only repositories for specific repositories. Useful when you're working on a part of the system where you only consume certain tables. (default is `false` - all mutable). |
| `enableDsl` | Enables the [SQL DSL](what-is/dsl.md) for code generation (default is `false`). |
| `keepDependencies` | Specifies whether to generate [table dependencies](type-safety/type-flow.md) in generated code even if you didn't select them (default is `false`). |
| `enableDsl` | Enables the [SQL DSL](../what-is/dsl.md) for code generation (default is `false`). |
| `keepDependencies` | Specifies whether to generate [table dependencies](../type-safety/type-flow.md) in generated code even if you didn't select them (default is `false`). |
| `rewriteDatabase` | Let's you perform arbitrary rewrites of database schema snapshot. you can add/remove rows, foreign keys and so on. |

## Development options
Expand Down
2 changes: 1 addition & 1 deletion site-in/other-features/faster-compilation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ And it's all full of implicit type class instances.

The main thing you can affect is to ask for less code to be generated.

This is done by [customizing selected relations](customization/customize-selected-relations.md).
This is done by [customizing selected relations](../customization/customize-selected-relations.md).

## The following measures have been taken to compile code fast

Expand Down
2 changes: 1 addition & 1 deletion site-in/other-features/flexible.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ For now you have the option of `doobie`, `anorm` or `zio-jdbc`, with `skunk` to

## Bring your own JSON library

In the same manner, you can generate JSON codecs for the library you already use, see [json](other-features/json.md)
In the same manner, you can generate JSON codecs for the library you already use, see [json](../other-features/json.md)
2 changes: 1 addition & 1 deletion site-in/other-features/streaming-inserts.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Streaming inserts with COPY API
---

If you [customize](customization/overview.md) Typo with `enableStreamingInserts = true`,
If you [customize](../customization/overview.md) Typo with `enableStreamingInserts = true`,
you can use the `insertStreaming` and `insertStreamingUnsaved` method on your repositories to insert a stream of data
into the database.

Expand Down
2 changes: 1 addition & 1 deletion site-in/other-features/testing-with-stubs.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interfaces backed by a mutable `Map`. This can be generated for all tables with

## DSL

Notable, these mocks work with the [dsl](what-is/dsl.md), which lets you describe semi-complex joins, updates, where predicates,
Notable, these mocks work with the [dsl](../what-is/dsl.md), which lets you describe semi-complex joins, updates, where predicates,
string operations and so on in your code, and test it in-memory!

### *Note
Expand Down
2 changes: 1 addition & 1 deletion site-in/patterns/dynamic-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Patterns: Dynamic queries"
---

If you use [sql files](what-is/sql-is-king.md), there is a very high chance you'll want some queries to
If you use [sql files](../what-is/sql-is-king.md), there is a very high chance you'll want some queries to
a bit dynamic. The way forward here is to move the dynamism into the sql itself.

A frequently used pattern is a query with an optional filter that selects all rows by default. This can be achieved using a IS NULL construct.
Expand Down
8 changes: 4 additions & 4 deletions site-in/patterns/multi-repo.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Patterns: The multi-repo"
---

There has been some comments about how [the generated repositories](what-is/relations.md) do not match with peoples preferences of what a repository should be.
There has been some comments about how [the generated repositories](../what-is/relations.md) do not match with peoples preferences of what a repository should be.
For instance you may prefer that your repositories coordinate multiple tables.

And that's more than fair - Often you need to coordinate multiple tables in a transaction.
Expand All @@ -18,9 +18,9 @@ You still get huge benefits from using Typo in this case:

- All of this is typesafe
- You get perfect auto-complete from your IDE
- Strongly typed [Id types](type-safety/id-types.md) and [type flow](type-safety/type-flow.md) ensure that you have to follow foreign keys correctly
- Strongly typed [Id types](../type-safety/id-types.md) and [type flow](../type-safety/type-flow.md) ensure that you have to follow foreign keys correctly
- It's fairly readable.
- It's testable! You can even wire in [stub repositories](other-features/testing-with-stubs.md) and test it all without a running database.
- It's testable! You can even wire in [stub repositories](../other-features/testing-with-stubs.md) and test it all without a running database.

Just have a look at the example and think how long it would take you to write this without Typo.

Expand Down Expand Up @@ -121,7 +121,7 @@ c.setAutoCommit(false)

Here is example usage:

Note that we can easily create a deep dependency graph with random data due to [testInsert](other-features/testing-with-random-values.md).
Note that we can easily create a deep dependency graph with random data due to [testInsert](../other-features/testing-with-random-values.md).
```scala mdoc:silent
import adventureworks.{TestInsert, withConnection}
import adventureworks.userdefined.FirstName
Expand Down
4 changes: 2 additions & 2 deletions site-in/type-safety/date-time.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ Typo uses its own wrapper types for date/time, which delegates to `java.time`.
For `timetz`, `OffsetTime` is used.
For `timestamptz`, `Instant` is used, since PostgreSQL store these timestamps in UTC.

See [typo-types](type-safety/typo-types.md) for some motivation for why the wrapper types were necessary.
See [typo-types](../type-safety/typo-types.md) for some motivation for why the wrapper types were necessary.

The most important reason was that the PostgreSQL driver loses precision and offsets, and for accuracy it's important to avoid that code path.
To that end, values are transferred as strings. You can make use of these data types outside of Typo if cast to `::text` explicitly in sql.

With Typo you can round-trip rows with `Instant` and the resulting row will compare equal to the one you inserted.

Ref [arrays](type-safety/arrays.md), arrays of date/times are usable if you define such a column.
Ref [arrays](../type-safety/arrays.md), arrays of date/times are usable if you define such a column.

```scala mdoc
import java.time.*
Expand Down
2 changes: 1 addition & 1 deletion site-in/type-safety/id-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ object EmployeedepartmenthistoryId {

## I don't want these

if you have some tables where you don't want the type-safety this brings, you can [customize](customization/overview.md)
if you have some tables where you don't want the type-safety this brings, you can [customize](../customization/overview.md)
code generation by tweaking `Options#enablePrimaryKeyType`:

```scala mdoc:silent
Expand Down
4 changes: 2 additions & 2 deletions site-in/type-safety/type-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Type flow
---

Typo follows "dependencies" between PostgreSQL columns (foreign keys and view dependencies) so the
more specific types (like [id types](../type-safety/id-types.md) and [user-selected-types](../type-safety/user-selected-types.md)) can "flow"
more specific types (like [id types](id-types.md) and [user-selected-types](user-selected-types.md)) can "flow"
downstream from the base column to other tables which reference it.

This makes it way easier to follow these relationships when coding against the generated code.
Expand All @@ -15,7 +15,7 @@ look below for things like
// Points to [[department.DepartmentRow.departmentid]]
```

These are by the way scaladoc links which can be [ctrl-clicked](other-features/clickable-links.md) in intellij to go to that column.
These are by the way scaladoc links which can be [ctrl-clicked](../other-features/clickable-links.md) in intellij to go to that column.


## Example generated row with type flow
Expand Down
6 changes: 3 additions & 3 deletions site-in/type-safety/user-selected-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ title: User-selected types
---

This functionality is present in Typo in order to:
- avoid generating [primary key types](type-safety/id-types.md) for what is typically strings and numbers if you already have such a type and you're integrating with an existing codebase.
- avoid generating [primary key types](id-types.md) for what is typically strings and numbers if you already have such a type and you're integrating with an existing codebase.
- to type up columns which should have had a more specific wrapper type, again typically strings or numbers

It's strongly discouraged to use it for anything else. In particular, you should *not* use it to avoid [Typo types](type-safety/typo-types.md)!
It's strongly discouraged to use it for anything else. In particular, you should *not* use it to avoid [Typo types](typo-types.md)!
They are there to work around bugs.

## Usage
You setup user-selected types by [Customizing column types](customization/customize-types.md).
You setup user-selected types by [Customizing column types](../customization/customize-types.md).

You need to implement a bunch of typeclass instances for the types you use.
The compiler will guide you, but it's basically everything which is needed to use the type with your database and json library.
Expand Down
8 changes: 4 additions & 4 deletions site-in/what-is/dsl.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ There is also a `delete` DSL, similar to `select` and `update`. It has no video

## Further reading

- [Getting started](setup.md) for some information about how to set up the DSL.
- [Limitations](limitations.md) for a caveat on how PostgreSQL infers nullability.
- [Customize sql files](customization/customize-sql-files.md) for how to override parameter/column names, types and nullability
- [Dynamic queries](patterns/dynamic-queries.md) for how to introduce some amount of dynamism in your queries
- [Getting started](../setup.md) for some information about how to set up the DSL.
- [Limitations](../limitations.md) for a caveat on how PostgreSQL infers nullability.
- [Customize sql files](../customization/customize-sql-files.md) for how to override parameter/column names, types and nullability
- [Dynamic queries](../patterns/dynamic-queries.md) for how to introduce some amount of dynamism in your queries

## Example usage:

Expand Down
6 changes: 3 additions & 3 deletions site-in/what-is/relations.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ comment on column address.spatiallocation is 'Latitude and longitude of this add

### Primary Key Types

Typo generates strongly typed [primary key types](type-safety/id-types.md), ensuring correct usage and enforcement of data integrity.
Typo generates strongly typed [primary key types](../type-safety/id-types.md), ensuring correct usage and enforcement of data integrity.
You also get types for composite primary keys.

```scala
Expand All @@ -59,7 +59,7 @@ object AddressId {
### Row Class

You'll receive a meticulously crafted row case class that precisely mirrors your table structure.
The field names are beautified (see [Customize naming](customization/customize-naming.md) for how to tweak naming),
The field names are beautified (see [Customize naming](../customization/customize-naming.md) for how to tweak naming),
and the corresponding types are correct.

Relevant column comments, check constraints and foreign keys are clearly marked,
Expand Down Expand Up @@ -166,7 +166,7 @@ case class AddressRowUnsaved(

### Readonly repositories

If you have a bunch of tables you just want to read, you can [customize](customization/overview.md)
If you have a bunch of tables you just want to read, you can [customize](../customization/overview.md)
the repositories to only expose read methods.

## Views
Expand Down
2 changes: 1 addition & 1 deletion site-in/what-is/sql-is-king.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ src="https://github.com/oyvindberg/typo/assets/247937/df7c4f2d-b118-4081-81c6-dd

This video shows how you can use parameters.

It also shows the syntax to [override inferred nullability and types](customization/customize-sql-files.md).
It also shows the syntax to [override inferred nullability and types](../customization/customize-sql-files.md).
While PostgreSQL is pretty good at both, it's not always exactly what you want.
In particular, parameters are optional by default.

Expand Down

0 comments on commit 91b8a43

Please sign in to comment.