Open
Description
I would like to implement a range for time(NaiveTime) in postgres.
In postgres, it looks like this (ref. https://www.postgresql.org/docs/13/rangetypes.html)
CREATE FUNCTION time_subtype_diff(x time, y time) RETURNS float8 AS
'SELECT EXTRACT(EPOCH FROM (x - y))' LANGUAGE sql STRICT IMMUTABLE;
CREATE TYPE timerange AS RANGE (
subtype = time,
subtype_diff = time_subtype_diff
);
SELECT '[11:10, 23:00]'::timerange;
I'd like to use PgRange<NaiveTime>
, but rustc tells me to implement Type<Postgres>
.
It looks like the Type implementation needs to implement fn type_info() -> PgTypeInfo
, but since PgTypeInfo
is pub(crate), it seems to be invisible outside of crate, and I don't think we can construct it.
Could you teach me how to do this?
Thanks.