Обсуждение: postgresql-unit 1.0 released

Поиск
Список
Период
Сортировка

postgresql-unit 1.0 released

От
Christoph Berg
Дата:
postgresql-unit 1.0 released
============================

postgresql-unit implements a PostgreSQL datatype for SI units, plus
byte. The base units can be combined to named and unnamed derived
units using operators defined in the PostgreSQL type system. SI
prefixes are used for input and output, and quantities can be
converted to arbitrary scale.


Examples
--------

# CREATE extension unit;
CREATE EXTENSION

# SELECT '800 m'::unit + '500 m' AS length;
 length
--------
 1.3 km

# SELECT '120 km/h'::unit AS speed;
    speed
-------------
 33.3333 m/s

# SELECT '9.81 N'::unit / 'kg' AS gravity;
  gravity
------------
 9.81 m/s^2

# SELECT '2 MB/min'::unit @ 'GB/d' AS traffic;
  traffic
-----------
 2.88 GB/d

# SELECT '1 hl'::unit @ '0.5 l' AS bottles_of_beer;
 bottles_of_beer
-----------------
 200 * 0.5 l


Features
--------

* SI base types: meter (m), kilogram (kg), second (s), ampere (A), kelvin (K),
  mole (mol), candela (cd)
* byte (B) is also a base type
* derived units coherent with SI: radian (rad), steradian (sr), hertz (Hz),
  newton (N), pascal (Pa), joule (J), watt (W), coulomb (C), volt (V), farad
  (F), ohm (Ω), siemens (S), weber (Wb), tesla (T), henry (H), degree Celsius
  (°C, support limited), lumen (lm), lux (lx), becquerel (Bq), gray (Gy),
  sievert (Sv), katal (kat)
* non-coherent units: minute (min), hour(h), day(d), hectare (ha), litre (l),
  tonne (t), bar, astronomical unit (au)
* prefix multiples: da, h, k, M, G, T, P, E, Z, Y
* prefix fractions: d, c, m, μ, n, p, f, a, z, y
* operators: +, -, *, /, ^, conversion to arbitrary scale (@)


Download
--------

The source tarball is available via GitHub:
https://github.com/ChristophBerg/postgresql-unit

Packages for Debian and Ubuntu are available via apt.postgresql.org.

Bug reports and feature requests are welcome!

Вложения