This commit is contained in:
Daniil Gentili 2024-03-31 17:17:04 +02:00
parent 6ab51ed3c3
commit 4306bbe24f
10 changed files with 35 additions and 33 deletions

View File

@ -1,5 +1,5 @@
{ {
"name": "danog/AsyncOrm", "name": "danog/async-orm",
"description": "Async ORM based on AMPHP v3 and fibers.", "description": "Async ORM based on AMPHP v3 and fibers.",
"type": "library", "type": "library",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",

View File

@ -1,5 +1,5 @@
--- ---
title: "danog\\AsyncOrm\\Annotations\\OrmMappedArray: " title: "danog\\AsyncOrm\\Annotations\\OrmMappedArray: Attribute use to autoconfigure ORM properties."
description: "" description: ""
--- ---
@ -10,7 +10,7 @@ description: ""
> Author: Alexander Pankratov <alexander@i-c-a.su> > Author: Alexander Pankratov <alexander@i-c-a.su>
Attribute use to autoconfigure ORM properties.

View File

@ -1,5 +1,5 @@
--- ---
title: "danog\\AsyncOrm\\Settings\\DriverSettings: Base class for database backends." title: "danog\\AsyncOrm\\Settings\\DriverSettings: Base settings class for database backends."
description: "" description: ""
--- ---
@ -10,7 +10,7 @@ description: ""
> Author: Alexander Pankratov <alexander@i-c-a.su> > Author: Alexander Pankratov <alexander@i-c-a.su>
Base class for database backends. Base settings class for database backends.

View File

@ -1,16 +1,16 @@
--- ---
title: "danog\\AsyncOrm\\Settings\\Memory: Memory backend settings." title: "danog\\AsyncOrm\\Settings\\MemorySettings: MemorySettings backend settings."
description: "" description: ""
--- ---
# `danog\AsyncOrm\Settings\Memory` # `danog\AsyncOrm\Settings\MemorySettings`
[Back to index](../../../index.md) [Back to index](../../../index.md)
> Author: Daniil Gentili <daniil@daniil.it> > Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su> > Author: Alexander Pankratov <alexander@i-c-a.su>
Memory backend settings. MemorySettings backend settings.

View File

@ -1,9 +1,9 @@
--- ---
title: "danog\\AsyncOrm\\Settings\\Mysql: MySQL backend settings." title: "danog\\AsyncOrm\\Settings\\MysqlSettings: MySQL backend settings."
description: "MariaDb 10.2+ or Mysql 5.6+ required." description: "MariaDb 10.2+ or Mysql 5.6+ required."
--- ---
# `danog\AsyncOrm\Settings\Mysql` # `danog\AsyncOrm\Settings\MysqlSettings`
[Back to index](../../../index.md) [Back to index](../../../index.md)
> Author: Daniil Gentili <daniil@daniil.it> > Author: Daniil Gentili <daniil@daniil.it>
@ -16,11 +16,11 @@ MariaDb 10.2+ or Mysql 5.6+ required.
## Constants ## Constants
* `danog\AsyncOrm\Settings\Mysql::DEFAULT_SQL_MAX_CONNECTIONS`: * `danog\AsyncOrm\Settings\MysqlSettings::DEFAULT_SQL_MAX_CONNECTIONS`:
* `danog\AsyncOrm\Settings\Mysql::DEFAULT_SQL_IDLE_TIMEOUT`: * `danog\AsyncOrm\Settings\MysqlSettings::DEFAULT_SQL_IDLE_TIMEOUT`:
* `danog\AsyncOrm\Settings\Mysql::DEFAULT_CACHE_TTL`: * `danog\AsyncOrm\Settings\MysqlSettings::DEFAULT_CACHE_TTL`:
## Properties ## Properties
* `$optimizeIfWastedMb`: `int<1, max>|null` * `$optimizeIfWastedMb`: `int<1, max>|null`

View File

@ -1,9 +1,9 @@
--- ---
title: "danog\\AsyncOrm\\Settings\\Postgres: Postgres backend settings." title: "danog\\AsyncOrm\\Settings\\PostgresSettings: Postgres backend settings."
description: "" description: ""
--- ---
# `danog\AsyncOrm\Settings\Postgres` # `danog\AsyncOrm\Settings\PostgresSettings`
[Back to index](../../../index.md) [Back to index](../../../index.md)
> Author: Daniil Gentili <daniil@daniil.it> > Author: Daniil Gentili <daniil@daniil.it>
@ -16,11 +16,11 @@ Postgres backend settings.
## Constants ## Constants
* `danog\AsyncOrm\Settings\Postgres::DEFAULT_SQL_MAX_CONNECTIONS`: * `danog\AsyncOrm\Settings\PostgresSettings::DEFAULT_SQL_MAX_CONNECTIONS`:
* `danog\AsyncOrm\Settings\Postgres::DEFAULT_SQL_IDLE_TIMEOUT`: * `danog\AsyncOrm\Settings\PostgresSettings::DEFAULT_SQL_IDLE_TIMEOUT`:
* `danog\AsyncOrm\Settings\Postgres::DEFAULT_CACHE_TTL`: * `danog\AsyncOrm\Settings\PostgresSettings::DEFAULT_CACHE_TTL`:
## Properties ## Properties
* `$maxConnections`: `positive-int` * `$maxConnections`: `positive-int`

View File

@ -1,9 +1,9 @@
--- ---
title: "danog\\AsyncOrm\\Settings\\Redis: Redis backend settings." title: "danog\\AsyncOrm\\Settings\\RedisSettings: Redis backend settings."
description: "" description: ""
--- ---
# `danog\AsyncOrm\Settings\Redis` # `danog\AsyncOrm\Settings\RedisSettings`
[Back to index](../../../index.md) [Back to index](../../../index.md)
> Author: Daniil Gentili <daniil@daniil.it> > Author: Daniil Gentili <daniil@daniil.it>
@ -16,7 +16,7 @@ Redis backend settings.
## Constants ## Constants
* `danog\AsyncOrm\Settings\Redis::DEFAULT_CACHE_TTL`: * `danog\AsyncOrm\Settings\RedisSettings::DEFAULT_CACHE_TTL`:
## Properties ## Properties
* `$config`: `\Amp\Redis\RedisConfig` * `$config`: `\Amp\Redis\RedisConfig`

View File

@ -16,22 +16,22 @@ Async ORM based on AMPHP v3 and fibers.
* [\danog\AsyncOrm\Settings: Base interface for ORM settings.](danog/AsyncOrm/Settings.md) * [\danog\AsyncOrm\Settings: Base interface for ORM settings.](danog/AsyncOrm/Settings.md)
* [\danog\AsyncOrm\Driver\DriverArray: Base class for driver-based arrays.](danog/AsyncOrm/Driver/DriverArray.md) * [\danog\AsyncOrm\Driver\DriverArray: Base class for driver-based arrays.](danog/AsyncOrm/Driver/DriverArray.md)
* [\danog\AsyncOrm\Driver\SqlArray: Generic SQL database backend.](danog/AsyncOrm/Driver/SqlArray.md) * [\danog\AsyncOrm\Driver\SqlArray: Generic SQL database backend.](danog/AsyncOrm/Driver/SqlArray.md)
* [\danog\AsyncOrm\Settings\DriverSettings: Base class for database backends.](danog/AsyncOrm/Settings/DriverSettings.md) * [\danog\AsyncOrm\Settings\DriverSettings: Base settings class for database backends.](danog/AsyncOrm/Settings/DriverSettings.md)
* [\danog\AsyncOrm\Settings\SqlSettings: Generic SQL db backend settings.](danog/AsyncOrm/Settings/SqlSettings.md) * [\danog\AsyncOrm\Settings\SqlSettings: Generic SQL db backend settings.](danog/AsyncOrm/Settings/SqlSettings.md)
## Classes ## Classes
* [\danog\AsyncOrm\FieldConfig: Contains configuration for a single ORM field.](danog/AsyncOrm/FieldConfig.md) * [\danog\AsyncOrm\FieldConfig: Contains configuration for a single ORM field.](danog/AsyncOrm/FieldConfig.md)
* [\danog\AsyncOrm\KeyType: Specifies the type of keys.](danog/AsyncOrm/KeyType.md) * [\danog\AsyncOrm\KeyType: Specifies the type of keys.](danog/AsyncOrm/KeyType.md)
* [\danog\AsyncOrm\ValueType: Specifies the serializer to use when saving values.](danog/AsyncOrm/ValueType.md) * [\danog\AsyncOrm\ValueType: Specifies the serializer to use when saving values.](danog/AsyncOrm/ValueType.md)
* [\danog\AsyncOrm\Annotations\OrmMappedArray](danog/AsyncOrm/Annotations/OrmMappedArray.md) * [\danog\AsyncOrm\Annotations\OrmMappedArray: Attribute use to autoconfigure ORM properties.](danog/AsyncOrm/Annotations/OrmMappedArray.md)
* [\danog\AsyncOrm\Driver\MemoryArray: Memory database backend.](danog/AsyncOrm/Driver/MemoryArray.md) * [\danog\AsyncOrm\Driver\MemoryArray: Memory database backend.](danog/AsyncOrm/Driver/MemoryArray.md)
* [\danog\AsyncOrm\Serializer\Igbinary: Igbinary serializer.](danog/AsyncOrm/Serializer/Igbinary.md) * [\danog\AsyncOrm\Serializer\Igbinary: Igbinary serializer.](danog/AsyncOrm/Serializer/Igbinary.md)
* [\danog\AsyncOrm\Serializer\Json: JSON serializer.](danog/AsyncOrm/Serializer/Json.md) * [\danog\AsyncOrm\Serializer\Json: JSON serializer.](danog/AsyncOrm/Serializer/Json.md)
* [\danog\AsyncOrm\Serializer\Native: Native serializer.](danog/AsyncOrm/Serializer/Native.md) * [\danog\AsyncOrm\Serializer\Native: Native serializer.](danog/AsyncOrm/Serializer/Native.md)
* [\danog\AsyncOrm\Settings\Memory: Memory backend settings.](danog/AsyncOrm/Settings/Memory.md) * [\danog\AsyncOrm\Settings\MemorySettings: MemorySettings backend settings.](danog/AsyncOrm/Settings/MemorySettings.md)
* [\danog\AsyncOrm\Settings\Mysql: MySQL backend settings.](danog/AsyncOrm/Settings/Mysql.md) * [\danog\AsyncOrm\Settings\MysqlSettings: MySQL backend settings.](danog/AsyncOrm/Settings/MysqlSettings.md)
* [\danog\AsyncOrm\Settings\Postgres: Postgres backend settings.](danog/AsyncOrm/Settings/Postgres.md) * [\danog\AsyncOrm\Settings\PostgresSettings: Postgres backend settings.](danog/AsyncOrm/Settings/PostgresSettings.md)
* [\danog\AsyncOrm\Settings\Redis: Redis backend settings.](danog/AsyncOrm/Settings/Redis.md) * [\danog\AsyncOrm\Settings\RedisSettings: Redis backend settings.](danog/AsyncOrm/Settings/RedisSettings.md)
## Traits ## Traits
* [\danog\AsyncOrm\DbAutoProperties](danog/AsyncOrm/DbAutoProperties.md) * [\danog\AsyncOrm\DbAutoProperties](danog/AsyncOrm/DbAutoProperties.md)

View File

@ -9,9 +9,7 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
* *
* @author Daniil Gentili <daniil@daniil.it> * @author Daniil Gentili <daniil@daniil.it>
* @author Alexander Pankratov <alexander@i-c-a.su>
* @copyright 2016-2024 Daniil Gentili <daniil@daniil.it> * @copyright 2016-2024 Daniil Gentili <daniil@daniil.it>
* @copyright 2016-2024 Alexander Pankratov <alexander@i-c-a.su>
* @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3
* @link https://docs.AsyncOrm.xyz AsyncOrm documentation * @link https://docs.AsyncOrm.xyz AsyncOrm documentation
*/ */
@ -22,7 +20,11 @@ use Attribute;
use danog\AsyncOrm\KeyType; use danog\AsyncOrm\KeyType;
use danog\AsyncOrm\ValueType; use danog\AsyncOrm\ValueType;
/** @api */ /**
* Attribute use to autoconfigure ORM properties.
*
* @api
*/
#[Attribute(Attribute::TARGET_PROPERTY)] #[Attribute(Attribute::TARGET_PROPERTY)]
final class OrmMappedArray final class OrmMappedArray
{ {

View File

@ -481,11 +481,11 @@ final class OrmTest extends TestCase
public function testCache(): void public function testCache(): void
{ {
$field = new FieldConfig("testCache", new Redis( $field = new FieldConfig("testCache", new RedisSettings(
RedisConfig::fromUri("redis://127.0.0.1"), RedisConfig::fromUri("redis://127.0.0.1"),
cacheTtl: 1 cacheTtl: 1
), KeyType::INT, ValueType::INT); ), KeyType::INT, ValueType::INT);
$fieldNoCache = new FieldConfig("testCache", new Redis( $fieldNoCache = new FieldConfig("testCache", new RedisSettings(
RedisConfig::fromUri("redis://127.0.0.1"), RedisConfig::fromUri("redis://127.0.0.1"),
cacheTtl: 0 cacheTtl: 0
), KeyType::INT, ValueType::INT); ), KeyType::INT, ValueType::INT);
@ -522,7 +522,7 @@ final class OrmTest extends TestCase
[ValueType::SCALAR, 123.321], [ValueType::SCALAR, 123.321],
] as [$valueType, $value]) { ] as [$valueType, $value]) {
if ($valueType === ValueType::OBJECT && ( if ($valueType === ValueType::OBJECT && (
$settings instanceof Memory $settings instanceof MemorySettings
|| $settings->serializer instanceof Json || $settings->serializer instanceof Json
)) { )) {
continue; continue;