index/src/Data/DbResultTrait.php

33 lines
902 B
PHP

<?php
// DbResultTrait.php
// Created: 2023-11-09
// Updated: 2023-11-09
namespace Index\Data;
trait DbResultTrait {
public function getString(int|string $index): string {
return (string)$this->getValue($index);
}
public function getStringOrNull(int|string $index): ?string {
return $this->isNull($index) ? null : (string)$this->getValue($index);
}
public function getInteger(int|string $index): int {
return (int)$this->getValue($index);
}
public function getIntegerOrNull(int|string $index): ?int {
return $this->isNull($index) ? null : (int)$this->getValue($index);
}
public function getFloat(int|string $index): float {
return (float)$this->getValue($index);
}
public function getFloatOrNull(int|string $index): ?float {
return $this->isNull($index) ? null : (float)$this->getValue($index);
}
}