Skip to content

feat: add ascents type and simple getters#70

Merged
lgrosz merged 8 commits intomainfrom
ascents
Mar 28, 2025
Merged

feat: add ascents type and simple getters#70
lgrosz merged 8 commits intomainfrom
ascents

Conversation

@lgrosz
Copy link
Copy Markdown
Owner

@lgrosz lgrosz commented Mar 24, 2025

This does not add the date window support, yet. This is because there is not a great native rust-postgres way of getting PostgreSQLs DATERANGE type. Looks like there's rust-postgres/rust-postgres-range#18, but it hasn't been merged in a year and the general state of rust-postgres-range seems unmaintained.. perhaps @tkbrigham has a good point in rust-postgres/rust-postgres#601.. it'd be great if all the PostgreSQL features were supported in rust-postgres directly.

This _does not_ add the date window support, yet. This is because there
is not a great native rust-postgres way of getting PostgreSQLs DATERANGE
type. Looks like there's rust-postgres/rust-postgres-range#18, but it hasn't
been merged in a year and the general state of rust-postgres-range seems
unmaintained.. perhaps @tkbrigham has a good point in
rust-postgres/rust-postgres#601.. it'd be great if all the PostgreSQL
features were supported in rust-postgres directly.
@lgrosz lgrosz force-pushed the ascents branch 4 times, most recently from 149af2c to 1f4910b Compare March 25, 2025 06:01
@lgrosz lgrosz force-pushed the ascents branch 5 times, most recently from b23b519 to 718a4ca Compare March 26, 2025 04:26
Currently, this can be thought of as a subset of an ISO 8601-2 interval
string.
For now, the date window is a string displayed like ISO 8601 with
intervals. It could make sense to make this a scalar of some kind to
enforce the implementation.

Some notes on implementation..

- the PostgreSQL `DATERANGE` type is queries as `::TEXT` since
  rust-postgres doesn't appear (or that I could find) to allow the user
  to specify the [format per returned column](https://www.postgresql.org/docs/9.3/protocol-overview.html#PROTOCOL-FORMAT-CODES).. and so the `FromSql`
  implementation must accept a `TEXT` type as well.

- the `DATERANGE` is [always of the format `[)`](https://www.postgresql.org/docs/current/rangetypes.html#RANGETYPES-DISCRETE) (or `()` when the bottom
  is unbounded), so this makes parsing quite simple. The PostgeSQL
  parser should be considered private to the `DateInterval` type

- the string formatting of date window attribute is done naively.. there
  are many things that can be done to make the returned values smaller
  and just as unambiguous
This mutation is used to date (verb) an ascent.
@lgrosz lgrosz merged commit 4cc7bfe into main Mar 28, 2025
4 of 5 checks passed
@lgrosz lgrosz deleted the ascents branch March 28, 2025 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant