class

Mayu::PostgresCounterDatabase

Inherits Mayu::CounterDatabase < Reference < Object

Constants

INCREMENT_STATEMENT = "insert into tb_count (name, created_at, updated_at, num)\nvalues ($1, #{SQLITE_DATETIME_NOW}, #{SQLITE_DATETIME_NOW}, 1)\non conflict (name) do update set\n num = tb_count.num + 1,\n updated_at = #{SQLITE_DATETIME_NOW}\nreturning name, num, created_at, updated_at;"
POOL_SIZE = 25
PRUNE_STATEMENT = "delete from tb_count\nwhere num < $1\n and updated_at is not null\n and updated_at < to_char(\n now() at time zone 'utc' - make_interval(days => $2),\n 'YYYY-MM-DD HH24:MI:SS'\n );"
SQLITE_DATETIME_NOW = "to_char(now() at time zone 'utc', 'YYYY-MM-DD HH24:MI:SS')"

Constructors

open(url : String) : PostgresCounterDatabase
Source

Instance methods

create_or_migrate_table
Source