Comments (3)
This should be easy for someone else to do by looking at the code and tests in Pgx_value_core and basically just doing the same thing for Ptime. Let me know if you're interested and run into any issues.
from pgx.
I'm interested in working on this issue. I was hoping to get some feedback about whether I'm on the right track, since I'm a bit of a beginner with OCaml.
Currently my pgx_value_ptime.mli
file looks like this:
type v = Pgx.Value.v [@@deriving compare, sexp_of]
type t = Pgx.Value.t [@@deriving compare, sexp_of]
include module type of Pgx.Value with type v := v and type t := t
val of_date : Ptime.date -> t
val to_date_exn : t -> Ptime.date
val to_date : t -> Ptime.date option
val of_time : ?tz_offset_s:Ptime.tz_offset_s -> Ptime.t -> t
val to_time_exn : t -> Ptime.t * Ptime.tz_offset_s
val to_time : t -> (Ptime.t * Ptime.tz_offset_s) option
val time_of_string : string -> Ptime.t * Ptime.tz_offset_s
Does the use of Ptime.t * Ptime.tz_offset_s
tuples make sense? In the core version, it looks like Time
contains a date, time of day, and timezone. However, Ptime.t
describes a POSIX timestamp in UTC, so there needs to be some additional way of storing the timezone information.
I thought about using Ptime.date * Ptime.time
instead; Ptime.time
does carry timezone information. I ruled this out because Ptime.time
has integer-valued seconds, which would mean a loss of precision.
from pgx.
@jsthomas Sorry, for some reason I didn't see the comment on here. One thing to consider is if it's necessary to pass the offset around at all. Another possible interface is to just always accept and return UTC timestamps. Although if Postgres stores offsets for some reason then having that be available in the interface is probably valuable for someone.
from pgx.
Related Issues (20)
- Module name clash HOT 1
- Support connection service file HOT 1
- Remove Pgx_async_test from the public API
- Pgx_eof errors are hard to debug HOT 1
- Support TLS encryption HOT 4
- Support TLS for Pgx_lwt_unix
- Support PG* environment variables for TLS configuration HOT 1
- Nested Transactions
- More guards around transactions
- Server hangs up during authentication HOT 5
- Support SASL and SCRAM-SHA-256
- Any ORM suite for OCaml , working with pgx together?
- Use BINARY mode for results HOT 1
- Wrong clause number in LGPL special exception
- Deprecated `Stream` module HOT 1
- unix_domain_socket_dir HOT 1
- Add Date and Time Pgx.Values for Lwt backend HOT 4
- Run dune-release lint in CI HOT 1
- Build in CI with `-p` argument HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pgx.