mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-01-16 18:04:34 -05:00
22 lines
477 B
PHP
22 lines
477 B
PHP
<?php
|
|
|
|
namespace Gazelle;
|
|
|
|
trait Pg {
|
|
protected static \Gazelle\DB\Pg $pgro; // R/O access
|
|
protected static \Gazelle\DB\Pg $pg; // R/W access
|
|
|
|
public function pgro(): DB\Pg {
|
|
return self::$pgro ??= new DB\Pg(PG_RO_DSN);
|
|
}
|
|
|
|
public function pg(): DB\Pg {
|
|
return self::pgStatic();
|
|
}
|
|
|
|
// disgusting hack required for \View class
|
|
public static function pgStatic(): DB\Pg {
|
|
return self::$pg ??= new DB\Pg(PG_RW_DSN);
|
|
}
|
|
}
|