Type-safe SQL query builder like QueryDSL or JOOQ in Java or Linq in .Net for TypeScript with MariaDB, MySql, Oracle, PostgreSql, Sqlite and SqlServer support.
Since #43, the LoggingQueryRunner calls process.hrtime.bigint() to get a timestamp for performance measurements. However, this API is not present in non-NodeJS environments (e.g. in the browser).
This PR adds a wrapper function that uses performance.now() as a fallback if the process module is not available.
Note: In theory we could migrate to using the value returned by performance.now() on all platforms. However, this would be a breaking change since some users might have subclassed the logger, because process.hrtime.bigint() returns nanoseconds as bigint, while performance.now() returns a float in milliseconds. To avoid a breaking change, I multiply the value returned from performance.now() by 1_000_000 and wrap it in a bigint, to stick to the same time base. Loss of precision might occur (but browsers may limit timing performance anyways for security reasons).
Since #43, the
LoggingQueryRunner
callsprocess.hrtime.bigint()
to get a timestamp for performance measurements. However, this API is not present in non-NodeJS environments (e.g. in the browser).This PR adds a wrapper function that uses
performance.now()
as a fallback if the process module is not available.Note: In theory we could migrate to using the value returned by
performance.now()
on all platforms. However, this would be a breaking change since some users might have subclassed the logger, becauseprocess.hrtime.bigint()
returns nanoseconds as bigint, whileperformance.now()
returns a float in milliseconds. To avoid a breaking change, I multiply the value returned fromperformance.now()
by 1_000_000 and wrap it in a bigint, to stick to the same time base. Loss of precision might occur (but browsers may limit timing performance anyways for security reasons).