Rename a few classes

This commit is contained in:
Daniil Gentili 2024-03-31 17:13:03 +02:00
parent 82b1f4faae
commit 6ab51ed3c3
38 changed files with 1834 additions and 32 deletions

View File

@ -1,5 +1,5 @@
{
"name": "danog/async-orm",
"name": "danog/AsyncOrm",
"description": "Async ORM based on AMPHP v3 and fibers.",
"type": "library",
"license": "AGPL-3.0-only",
@ -10,7 +10,7 @@
},
"autoload-dev": {
"psr-4": {
"danog\\AsyncOrm\\Test\\": "tests/"
"danog\\TestAsyncOrm\\": "tests/"
}
},
"authors": [

View File

@ -0,0 +1,50 @@
---
title: "danog\\AsyncOrm\\Annotations\\OrmMappedArray: "
description: ""
---
# `danog\AsyncOrm\Annotations\OrmMappedArray`
[Back to index](../../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
## Properties
* `$keyType`: `\danog\AsyncOrm\KeyType` Key type.
* `$valueType`: `\danog\AsyncOrm\ValueType` Value type.
* `$cacheTtl`: `int<0, max>|null`
* `$optimizeIfWastedMb`: `int<1, max>|null`
* `$tablePostfix`: `?string` Table name postfix, if null defaults to the property name.
## Method list:
* [`__construct(\danog\AsyncOrm\KeyType $keyType, \danog\AsyncOrm\ValueType $valueType, ?int $cacheTtl = NULL, ?int $optimizeIfWastedMb = NULL, ?string $tablePostfix = NULL)`](#__construct-danog-asyncorm-keytype-keytype-danog-asyncorm-valuetype-valuetype-int-cachettl-null-int-optimizeifwastedmb-null-string-tablepostfix-null)
## Methods:
### `__construct(\danog\AsyncOrm\KeyType $keyType, \danog\AsyncOrm\ValueType $valueType, ?int $cacheTtl = NULL, ?int $optimizeIfWastedMb = NULL, ?string $tablePostfix = NULL)`
Parameters:
* `$keyType`: `\danog\AsyncOrm\KeyType`
* `$valueType`: `\danog\AsyncOrm\ValueType`
* `$cacheTtl`: `?int`
* `$optimizeIfWastedMb`: `?int`
* `$tablePostfix`: `?string`
#### See also:
* [`\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)
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,210 @@
---
title: "danog\\AsyncOrm\\DbArray: DB array interface."
description: ""
---
# `danog\AsyncOrm\DbArray`
[Back to index](../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
DB array interface.
## Method list:
* [`isset(\TKey $key): bool`](#isset-tkey-key-bool)
* [`offsetGet(\TKey $offset): \TValue`](#offsetget-tkey-offset-tvalue)
* [`offsetExists(\TKey $offset): bool`](#offsetexists-tkey-offset-bool)
* [`offsetSet(\TKey $offset, \TValue $value): void`](#offsetset-tkey-offset-tvalue-value-void)
* [`offsetUnset(\TKey $offset): void`](#offsetunset-tkey-offset-void)
* [`getArrayCopy(): array`](#getarraycopy-array)
* [`unset(\TKey $key): void`](#unset-tkey-key-void)
* [`set(\TKey $key, \TValue $value): void`](#set-tkey-key-tvalue-value-void)
* [`get(\TKey $key): ?\TValue`](#get-tkey-key-tvalue)
* [`clear(): void`](#clear-void)
* [`getInstance(\danog\AsyncOrm\FieldConfig $config, ?self $previous): self`](#getinstance-danog-asyncorm-fieldconfig-config-self-previous-self)
* [`count(): mixed`](#count-mixed)
* [`getIterator(): mixed`](#getiterator-mixed)
## Methods:
### `isset(\TKey $key): bool`
Check if element exists.
Parameters:
* `$key`: `\TKey`
#### See also:
* `\TKey`
### `offsetGet(\TKey $offset): \TValue`
Parameters:
* `$offset`: `\TKey`
#### See also:
* `\TKey`
* `\TValue`
### `offsetExists(\TKey $offset): bool`
Parameters:
* `$offset`: `\TKey`
#### See also:
* `\TKey`
### `offsetSet(\TKey $offset, \TValue $value): void`
Parameters:
* `$offset`: `\TKey`
* `$value`: `\TValue`
#### See also:
* `\TKey`
* `\TValue`
### `offsetUnset(\TKey $offset): void`
Parameters:
* `$offset`: `\TKey`
#### See also:
* `\TKey`
### `getArrayCopy(): array`
### `unset(\TKey $key): void`
Unset element.
Parameters:
* `$key`: `\TKey`
#### See also:
* `\TKey`
### `set(\TKey $key, \TValue $value): void`
Set element.
Parameters:
* `$key`: `\TKey`
* `$value`: `\TValue`
#### See also:
* `\TKey`
* `\TValue`
### `get(\TKey $key): ?\TValue`
Get element.
Parameters:
* `$key`: `\TKey`
#### See also:
* `\TKey`
* `\TValue`
### `clear(): void`
Clear all elements.
### `getInstance(\danog\AsyncOrm\FieldConfig $config, ?self $previous): self`
Get instance.
Parameters:
* `$config`: `\danog\AsyncOrm\FieldConfig`
* `$previous`: `?self`
#### See also:
* [`\danog\AsyncOrm\FieldConfig`: Contains configuration for a single ORM field.](../../danog/AsyncOrm/FieldConfig.md)
### `count(): mixed`
### `getIterator(): mixed`
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,47 @@
---
title: "danog\\AsyncOrm\\DbAutoProperties: "
description: ""
---
# `danog\AsyncOrm\DbAutoProperties`
[Back to index](../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
## Method list:
* [`initDbProperties(\danog\AsyncOrm\Settings $settings, string $tablePrefix): void`](#initdbproperties-danog-asyncorm-settings-settings-string-tableprefix-void)
* [`saveDbProperties(): void`](#savedbproperties-void)
## Methods:
### `initDbProperties(\danog\AsyncOrm\Settings $settings, string $tablePrefix): void`
Initialize database properties.
Parameters:
* `$settings`: `\danog\AsyncOrm\Settings`
* `$tablePrefix`: `string`
#### See also:
* [`\danog\AsyncOrm\Settings`: Base interface for ORM settings.](../../danog/AsyncOrm/Settings.md)
### `saveDbProperties(): void`
Save all properties.
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,29 @@
---
title: "danog\\AsyncOrm\\DbObject: "
description: ""
---
# `danog\AsyncOrm\DbObject`
[Back to index](../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
## Method list:
* [`save(): void`](#save-void)
## Methods:
### `save(): void`
Save object to database.
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,211 @@
---
title: "danog\\AsyncOrm\\Driver\\DriverArray: Base class for driver-based arrays."
description: ""
---
# `danog\AsyncOrm\Driver\DriverArray`
[Back to index](../../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
Base class for driver-based arrays.
## Method list:
* [`getInstance(\danog\AsyncOrm\FieldConfig $config, ?\danog\AsyncOrm\DbArray $previous): \danog\AsyncOrm\DbArray`](#getinstance-danog-asyncorm-fieldconfig-config-danog-asyncorm-dbarray-previous-danog-asyncorm-dbarray)
* [`isset(\TKey $key): bool`](#isset-tkey-key-bool)
* [`offsetGet(\TKey $offset): \TValue`](#offsetget-tkey-offset-tvalue)
* [`offsetExists(\TKey $offset): bool`](#offsetexists-tkey-offset-bool)
* [`offsetSet(\TKey $offset, \TValue $value): void`](#offsetset-tkey-offset-tvalue-value-void)
* [`offsetUnset(\TKey $offset): void`](#offsetunset-tkey-offset-void)
* [`getArrayCopy(): array`](#getarraycopy-array)
* [`unset(\TKey $key): void`](#unset-tkey-key-void)
* [`set(\TKey $key, \TValue $value): void`](#set-tkey-key-tvalue-value-void)
* [`get(\TKey $key): ?\TValue`](#get-tkey-key-tvalue)
* [`clear(): void`](#clear-void)
* [`count(): mixed`](#count-mixed)
* [`getIterator(): mixed`](#getiterator-mixed)
## Methods:
### `getInstance(\danog\AsyncOrm\FieldConfig $config, ?\danog\AsyncOrm\DbArray $previous): \danog\AsyncOrm\DbArray`
Parameters:
* `$config`: `\danog\AsyncOrm\FieldConfig`
* `$previous`: `?\danog\AsyncOrm\DbArray`
#### See also:
* [`\danog\AsyncOrm\FieldConfig`: Contains configuration for a single ORM field.](../../../danog/AsyncOrm/FieldConfig.md)
* [`\danog\AsyncOrm\DbArray`: DB array interface.](../../../danog/AsyncOrm/DbArray.md)
### `isset(\TKey $key): bool`
Check if element exists.
Parameters:
* `$key`: `\TKey`
#### See also:
* `\TKey`
### `offsetGet(\TKey $offset): \TValue`
Parameters:
* `$offset`: `\TKey`
#### See also:
* `\TKey`
* `\TValue`
### `offsetExists(\TKey $offset): bool`
Parameters:
* `$offset`: `\TKey`
#### See also:
* `\TKey`
### `offsetSet(\TKey $offset, \TValue $value): void`
Parameters:
* `$offset`: `\TKey`
* `$value`: `\TValue`
#### See also:
* `\TKey`
* `\TValue`
### `offsetUnset(\TKey $offset): void`
Parameters:
* `$offset`: `\TKey`
#### See also:
* `\TKey`
### `getArrayCopy(): array`
### `unset(\TKey $key): void`
Unset element.
Parameters:
* `$key`: `\TKey`
#### See also:
* `\TKey`
### `set(\TKey $key, \TValue $value): void`
Set element.
Parameters:
* `$key`: `\TKey`
* `$value`: `\TValue`
#### See also:
* `\TKey`
* `\TValue`
### `get(\TKey $key): ?\TValue`
Get element.
Parameters:
* `$key`: `\TKey`
#### See also:
* `\TKey`
* `\TValue`
### `clear(): void`
Clear all elements.
### `count(): mixed`
### `getIterator(): mixed`
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,211 @@
---
title: "danog\\AsyncOrm\\Driver\\MemoryArray: Memory database backend."
description: ""
---
# `danog\AsyncOrm\Driver\MemoryArray`
[Back to index](../../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
Memory database backend.
## Method list:
* [`__construct(array $data)`](#__construct-array-data)
* [`getInstance(\danog\AsyncOrm\FieldConfig $config, ?\danog\AsyncOrm\DbArray $previous): \danog\AsyncOrm\DbArray`](#getinstance-danog-asyncorm-fieldconfig-config-danog-asyncorm-dbarray-previous-danog-asyncorm-dbarray)
* [`set(string|int $key, mixed $value): void`](#set-string-int-key-mixed-value-void)
* [`get(string|int $key): mixed`](#get-string-int-key-mixed)
* [`unset(string|int $key): void`](#unset-string-int-key-void)
* [`clear(): void`](#clear-void)
* [`count(): int`](#count-int)
* [`getIterator(): \Traversable`](#getiterator-traversable)
* [`getArrayCopy(): array`](#getarraycopy-array)
* [`isset(\TKey $key): bool`](#isset-tkey-key-bool)
* [`offsetGet(\TKey $offset): \TValue`](#offsetget-tkey-offset-tvalue)
* [`offsetExists(\TKey $offset): bool`](#offsetexists-tkey-offset-bool)
* [`offsetSet(\TKey $offset, \TValue $value): void`](#offsetset-tkey-offset-tvalue-value-void)
* [`offsetUnset(\TKey $offset): void`](#offsetunset-tkey-offset-void)
## Methods:
### `__construct(array $data)`
Parameters:
* `$data`: `array`
### `getInstance(\danog\AsyncOrm\FieldConfig $config, ?\danog\AsyncOrm\DbArray $previous): \danog\AsyncOrm\DbArray`
Parameters:
* `$config`: `\danog\AsyncOrm\FieldConfig`
* `$previous`: `?\danog\AsyncOrm\DbArray`
#### See also:
* [`\danog\AsyncOrm\FieldConfig`: Contains configuration for a single ORM field.](../../../danog/AsyncOrm/FieldConfig.md)
* [`\danog\AsyncOrm\DbArray`: DB array interface.](../../../danog/AsyncOrm/DbArray.md)
### `set(string|int $key, mixed $value): void`
Parameters:
* `$key`: `string|int`
* `$value`: `mixed`
### `get(string|int $key): mixed`
Parameters:
* `$key`: `string|int`
### `unset(string|int $key): void`
Parameters:
* `$key`: `string|int`
### `clear(): void`
### `count(): int`
### `getIterator(): \Traversable`
#### See also:
* `\Traversable`
### `getArrayCopy(): array`
### `isset(\TKey $key): bool`
Check if element exists.
Parameters:
* `$key`: `\TKey`
#### See also:
* `\TKey`
### `offsetGet(\TKey $offset): \TValue`
Parameters:
* `$offset`: `\TKey`
#### See also:
* `\TKey`
* `\TValue`
### `offsetExists(\TKey $offset): bool`
Parameters:
* `$offset`: `\TKey`
#### See also:
* `\TKey`
### `offsetSet(\TKey $offset, \TValue $value): void`
Parameters:
* `$offset`: `\TKey`
* `$value`: `\TValue`
#### See also:
* `\TKey`
* `\TValue`
### `offsetUnset(\TKey $offset): void`
Parameters:
* `$offset`: `\TKey`
#### See also:
* `\TKey`
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,204 @@
---
title: "danog\\AsyncOrm\\Driver\\SqlArray: Generic SQL database backend."
description: ""
---
# `danog\AsyncOrm\Driver\SqlArray`
[Back to index](../../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
Generic SQL database backend.
## Method list:
* [`getIterator(): \Traversable<array-key, mixed>`](#getiterator-traversable-array-key-mixed)
* [`get(mixed $key): mixed`](#get-mixed-key-mixed)
* [`set(string|int $key, mixed $value): void`](#set-string-int-key-mixed-value-void)
* [`unset(string|int $key): void`](#unset-string-int-key-void)
* [`count(): \int The number of elements or public properties in the associated
array or object, respectively.`](#count-int-the-number-of-elements-or-public-properties-in-the-associated-array-or-object-respectively)
* [`clear(): void`](#clear-void)
* [`getInstance(\danog\AsyncOrm\FieldConfig $config, ?\danog\AsyncOrm\DbArray $previous): \danog\AsyncOrm\DbArray`](#getinstance-danog-asyncorm-fieldconfig-config-danog-asyncorm-dbarray-previous-danog-asyncorm-dbarray)
* [`isset(\TKey $key): bool`](#isset-tkey-key-bool)
* [`offsetGet(\TKey $offset): \TValue`](#offsetget-tkey-offset-tvalue)
* [`offsetExists(\TKey $offset): bool`](#offsetexists-tkey-offset-bool)
* [`offsetSet(\TKey $offset, \TValue $value): void`](#offsetset-tkey-offset-tvalue-value-void)
* [`offsetUnset(\TKey $offset): void`](#offsetunset-tkey-offset-void)
* [`getArrayCopy(): array`](#getarraycopy-array)
## Methods:
### `getIterator(): \Traversable<array-key, mixed>`
Get iterator.
#### See also:
* `\Traversable`
### `get(mixed $key): mixed`
Parameters:
* `$key`: `mixed`
### `set(string|int $key, mixed $value): void`
Parameters:
* `$key`: `string|int`
* `$value`: `mixed`
### `unset(string|int $key): void`
Unset value for an offset.
Parameters:
* `$key`: `string|int`
### `count(): \int The number of elements or public properties in the associated
array or object, respectively.`
Count elements.
Return value: The number of elements or public properties in the associated
array or object, respectively.
### `clear(): void`
Clear all elements.
### `getInstance(\danog\AsyncOrm\FieldConfig $config, ?\danog\AsyncOrm\DbArray $previous): \danog\AsyncOrm\DbArray`
Parameters:
* `$config`: `\danog\AsyncOrm\FieldConfig`
* `$previous`: `?\danog\AsyncOrm\DbArray`
#### See also:
* [`\danog\AsyncOrm\FieldConfig`: Contains configuration for a single ORM field.](../../../danog/AsyncOrm/FieldConfig.md)
* [`\danog\AsyncOrm\DbArray`: DB array interface.](../../../danog/AsyncOrm/DbArray.md)
### `isset(\TKey $key): bool`
Check if element exists.
Parameters:
* `$key`: `\TKey`
#### See also:
* `\TKey`
### `offsetGet(\TKey $offset): \TValue`
Parameters:
* `$offset`: `\TKey`
#### See also:
* `\TKey`
* `\TValue`
### `offsetExists(\TKey $offset): bool`
Parameters:
* `$offset`: `\TKey`
#### See also:
* `\TKey`
### `offsetSet(\TKey $offset, \TValue $value): void`
Parameters:
* `$offset`: `\TKey`
* `$value`: `\TValue`
#### See also:
* `\TKey`
* `\TValue`
### `offsetUnset(\TKey $offset): void`
Parameters:
* `$offset`: `\TKey`
#### See also:
* `\TKey`
### `getArrayCopy(): array`
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,66 @@
---
title: "danog\\AsyncOrm\\FieldConfig: Contains configuration for a single ORM field."
description: ""
---
# `danog\AsyncOrm\FieldConfig`
[Back to index](../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
Contains configuration for a single ORM field.
## Properties
* `$table`: `string` Table name.
* `$settings`: `\danog\AsyncOrm\Settings` Settings.
* `$keyType`: `\danog\AsyncOrm\KeyType` Key type.
* `$valueType`: `\danog\AsyncOrm\ValueType` Value type.
## Method list:
* [`__construct(string $table, \danog\AsyncOrm\Settings $settings, \danog\AsyncOrm\KeyType $keyType, \danog\AsyncOrm\ValueType $valueType)`](#__construct-string-table-danog-asyncorm-settings-settings-danog-asyncorm-keytype-keytype-danog-asyncorm-valuetype-valuetype)
* [`build(?\danog\AsyncOrm\DbArray $previous = NULL): \danog\AsyncOrm\DbArray`](#build-danog-asyncorm-dbarray-previous-null-danog-asyncorm-dbarray)
## Methods:
### `__construct(string $table, \danog\AsyncOrm\Settings $settings, \danog\AsyncOrm\KeyType $keyType, \danog\AsyncOrm\ValueType $valueType)`
Parameters:
* `$table`: `string`
* `$settings`: `\danog\AsyncOrm\Settings`
* `$keyType`: `\danog\AsyncOrm\KeyType`
* `$valueType`: `\danog\AsyncOrm\ValueType`
#### See also:
* [`\danog\AsyncOrm\Settings`: Base interface for ORM settings.](../../danog/AsyncOrm/Settings.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)
### `build(?\danog\AsyncOrm\DbArray $previous = NULL): \danog\AsyncOrm\DbArray`
Build database array.
Parameters:
* `$previous`: `?\danog\AsyncOrm\DbArray`
#### See also:
* [`\danog\AsyncOrm\DbArray`: DB array interface.](../../danog/AsyncOrm/DbArray.md)
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,64 @@
---
title: "danog\\AsyncOrm\\KeyType: Specifies the type of keys."
description: ""
---
# `danog\AsyncOrm\KeyType`
[Back to index](../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
Specifies the type of keys.
## Constants
* `danog\AsyncOrm\KeyType::STRING_OR_INT`: Strings or integers.
* `danog\AsyncOrm\KeyType::STRING`: Only strings.
* `danog\AsyncOrm\KeyType::INT`: Only integers.
## Properties
* `$name`: `string`
* `$value`: `string`
## Method list:
* [`cases(): array`](#cases-array)
* [`from(string|int $value): static`](#from-string-int-value-static)
* [`tryFrom(string|int $value): ?static`](#tryfrom-string-int-value-static)
## Methods:
### `cases(): array`
### `from(string|int $value): static`
Parameters:
* `$value`: `string|int`
### `tryFrom(string|int $value): ?static`
Parameters:
* `$value`: `string|int`
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,56 @@
---
title: "danog\\AsyncOrm\\Serializer: Serializer interface."
description: ""
---
# `danog\AsyncOrm\Serializer`
[Back to index](../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
Serializer interface.
## Method list:
* [`serialize(\TValue $value): mixed`](#serialize-tvalue-value-mixed)
* [`deserialize(mixed $value): \TValue`](#deserialize-mixed-value-tvalue)
## Methods:
### `serialize(\TValue $value): mixed`
Parameters:
* `$value`: `\TValue`
#### See also:
* `\TValue`
### `deserialize(mixed $value): \TValue`
Parameters:
* `$value`: `mixed`
#### See also:
* `\TValue`
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,46 @@
---
title: "danog\\AsyncOrm\\Serializer\\Igbinary: Igbinary serializer."
description: ""
---
# `danog\AsyncOrm\Serializer\Igbinary`
[Back to index](../../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
Igbinary serializer.
## Method list:
* [`serialize(mixed $value): mixed`](#serialize-mixed-value-mixed)
* [`deserialize(mixed $value): mixed`](#deserialize-mixed-value-mixed)
## Methods:
### `serialize(mixed $value): mixed`
Parameters:
* `$value`: `mixed`
### `deserialize(mixed $value): mixed`
Parameters:
* `$value`: `mixed`
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,46 @@
---
title: "danog\\AsyncOrm\\Serializer\\Json: JSON serializer."
description: ""
---
# `danog\AsyncOrm\Serializer\Json`
[Back to index](../../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
JSON serializer.
## Method list:
* [`serialize(mixed $value): mixed`](#serialize-mixed-value-mixed)
* [`deserialize(mixed $value): mixed`](#deserialize-mixed-value-mixed)
## Methods:
### `serialize(mixed $value): mixed`
Parameters:
* `$value`: `mixed`
### `deserialize(mixed $value): mixed`
Parameters:
* `$value`: `mixed`
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,46 @@
---
title: "danog\\AsyncOrm\\Serializer\\Native: Native serializer."
description: ""
---
# `danog\AsyncOrm\Serializer\Native`
[Back to index](../../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
Native serializer.
## Method list:
* [`serialize(mixed $value): mixed`](#serialize-mixed-value-mixed)
* [`deserialize(mixed $value): mixed`](#deserialize-mixed-value-mixed)
## Methods:
### `serialize(mixed $value): mixed`
Parameters:
* `$value`: `mixed`
### `deserialize(mixed $value): mixed`
Parameters:
* `$value`: `mixed`
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,34 @@
---
title: "danog\\AsyncOrm\\Settings: Base interface for ORM settings."
description: ""
---
# `danog\AsyncOrm\Settings`
[Back to index](../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
Base interface for ORM settings.
## Method list:
* [`getDriverClass(): class-string<\danog\AsyncOrm\DbArray>`](#getdriverclass-class-string-danog-asyncorm-dbarray)
## Methods:
### `getDriverClass(): class-string<\danog\AsyncOrm\DbArray>`
#### See also:
* [`\danog\AsyncOrm\DbArray`: DB array interface.](../../danog/AsyncOrm/DbArray.md)
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,59 @@
---
title: "danog\\AsyncOrm\\Settings\\DriverSettings: Base class for database backends."
description: ""
---
# `danog\AsyncOrm\Settings\DriverSettings`
[Back to index](../../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
Base class for database backends.
## Constants
* `danog\AsyncOrm\Settings\DriverSettings::DEFAULT_CACHE_TTL`:
## Properties
* `$serializer`: `\danog\AsyncOrm\Serializer`
* `$cacheTtl`: `int<0, max>` For how long to keep records in memory after last read.
## Method list:
* [`__construct(?\danog\AsyncOrm\Serializer $serializer = NULL, int $cacheTtl = \self::DEFAULT_CACHE_TTL)`](#__construct-danog-asyncorm-serializer-serializer-null-int-cachettl-self-default_cache_ttl)
* [`getDriverClass(): class-string<\danog\AsyncOrm\DbArray>`](#getdriverclass-class-string-danog-asyncorm-dbarray)
## Methods:
### `__construct(?\danog\AsyncOrm\Serializer $serializer = NULL, int $cacheTtl = \self::DEFAULT_CACHE_TTL)`
Parameters:
* `$serializer`: `?\danog\AsyncOrm\Serializer` to use for object and mixed type values, if null defaults to either Igbinary or Native.
* `$cacheTtl`: `int`
#### See also:
* [`\danog\AsyncOrm\Serializer`: Serializer interface.](../../../danog/AsyncOrm/Serializer.md)
### `getDriverClass(): class-string<\danog\AsyncOrm\DbArray>`
#### See also:
* [`\danog\AsyncOrm\DbArray`: DB array interface.](../../../danog/AsyncOrm/DbArray.md)
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,29 @@
---
title: "danog\\AsyncOrm\\Settings\\Memory: Memory backend settings."
description: ""
---
# `danog\AsyncOrm\Settings\Memory`
[Back to index](../../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
Memory backend settings.
## Method list:
* [`getDriverClass(): string`](#getdriverclass-string)
## Methods:
### `getDriverClass(): string`
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,68 @@
---
title: "danog\\AsyncOrm\\Settings\\Mysql: MySQL backend settings."
description: "MariaDb 10.2+ or Mysql 5.6+ required."
---
# `danog\AsyncOrm\Settings\Mysql`
[Back to index](../../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
MySQL backend settings.
MariaDb 10.2+ or Mysql 5.6+ required.
## Constants
* `danog\AsyncOrm\Settings\Mysql::DEFAULT_SQL_MAX_CONNECTIONS`:
* `danog\AsyncOrm\Settings\Mysql::DEFAULT_SQL_IDLE_TIMEOUT`:
* `danog\AsyncOrm\Settings\Mysql::DEFAULT_CACHE_TTL`:
## Properties
* `$optimizeIfWastedMb`: `int<1, max>|null`
* `$maxConnections`: `positive-int`
* `$idleTimeout`: `positive-int`
* `$config`: `\T`
* `$serializer`: `\danog\AsyncOrm\Serializer`
* `$cacheTtl`: `int<0, max>` For how long to keep records in memory after last read.
## Method list:
* [`__construct(\Amp\Mysql\MysqlConfig $config, ?\danog\AsyncOrm\Serializer $serializer = NULL, int<\0, \max> $cacheTtl = \self::DEFAULT_CACHE_TTL, int<\1, \max> $maxConnections = \self::DEFAULT_SQL_MAX_CONNECTIONS, int<\1, \max> $idleTimeout = \self::DEFAULT_SQL_IDLE_TIMEOUT, ?int $optimizeIfWastedMb = NULL)`](#__construct-amp-mysql-mysqlconfig-config-danog-asyncorm-serializer-serializer-null-int-0-max-cachettl-self-default_cache_ttl-int-1-max-maxconnections-self-default_sql_max_connections-int-1-max-idletimeout-self-default_sql_idle_timeout-int-optimizeifwastedmb-null)
* [`getDriverClass(): string`](#getdriverclass-string)
## Methods:
### `__construct(\Amp\Mysql\MysqlConfig $config, ?\danog\AsyncOrm\Serializer $serializer = NULL, int<\0, \max> $cacheTtl = \self::DEFAULT_CACHE_TTL, int<\1, \max> $maxConnections = \self::DEFAULT_SQL_MAX_CONNECTIONS, int<\1, \max> $idleTimeout = \self::DEFAULT_SQL_IDLE_TIMEOUT, ?int $optimizeIfWastedMb = NULL)`
Parameters:
* `$config`: `\Amp\Mysql\MysqlConfig`
* `$serializer`: `?\danog\AsyncOrm\Serializer` to use for object and mixed type values, if null defaults to either Igbinary or Native.
* `$cacheTtl`: `int<\0, \max>` Cache TTL in seconds, if 0 disables caching.
* `$maxConnections`: `int<\1, \max>` Maximum connection limit
* `$idleTimeout`: `int<\1, \max>` Idle timeout
* `$optimizeIfWastedMb`: `?int`
#### See also:
* `\Amp\Mysql\MysqlConfig`
* [`\danog\AsyncOrm\Serializer`: Serializer interface.](../../../danog/AsyncOrm/Serializer.md)
* `\max`
### `getDriverClass(): string`
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,66 @@
---
title: "danog\\AsyncOrm\\Settings\\Postgres: Postgres backend settings."
description: ""
---
# `danog\AsyncOrm\Settings\Postgres`
[Back to index](../../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
Postgres backend settings.
## Constants
* `danog\AsyncOrm\Settings\Postgres::DEFAULT_SQL_MAX_CONNECTIONS`:
* `danog\AsyncOrm\Settings\Postgres::DEFAULT_SQL_IDLE_TIMEOUT`:
* `danog\AsyncOrm\Settings\Postgres::DEFAULT_CACHE_TTL`:
## Properties
* `$maxConnections`: `positive-int`
* `$idleTimeout`: `positive-int`
* `$config`: `\T`
* `$serializer`: `\danog\AsyncOrm\Serializer`
* `$cacheTtl`: `int<0, max>` For how long to keep records in memory after last read.
## Method list:
* [`__construct(\Amp\Postgres\PostgresConfig $config, ?\danog\AsyncOrm\Serializer $serializer = NULL, int<\0, \max> $cacheTtl = \self::DEFAULT_CACHE_TTL, int<\1, \max> $maxConnections = \self::DEFAULT_SQL_MAX_CONNECTIONS, int<\1, \max> $idleTimeout = \self::DEFAULT_SQL_IDLE_TIMEOUT)`](#__construct-amp-postgres-postgresconfig-config-danog-asyncorm-serializer-serializer-null-int-0-max-cachettl-self-default_cache_ttl-int-1-max-maxconnections-self-default_sql_max_connections-int-1-max-idletimeout-self-default_sql_idle_timeout)
* [`getDriverClass(): string`](#getdriverclass-string)
## Methods:
### `__construct(\Amp\Postgres\PostgresConfig $config, ?\danog\AsyncOrm\Serializer $serializer = NULL, int<\0, \max> $cacheTtl = \self::DEFAULT_CACHE_TTL, int<\1, \max> $maxConnections = \self::DEFAULT_SQL_MAX_CONNECTIONS, int<\1, \max> $idleTimeout = \self::DEFAULT_SQL_IDLE_TIMEOUT)`
Parameters:
* `$config`: `\Amp\Postgres\PostgresConfig`
* `$serializer`: `?\danog\AsyncOrm\Serializer` to use for object and mixed type values, if null defaults to either Igbinary or Native.
* `$cacheTtl`: `int<\0, \max>` Cache TTL in seconds
* `$maxConnections`: `int<\1, \max>` Maximum connection limit
* `$idleTimeout`: `int<\1, \max>` Idle timeout
#### See also:
* `\Amp\Postgres\PostgresConfig`
* [`\danog\AsyncOrm\Serializer`: Serializer interface.](../../../danog/AsyncOrm/Serializer.md)
* `\max`
### `getDriverClass(): string`
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,58 @@
---
title: "danog\\AsyncOrm\\Settings\\Redis: Redis backend settings."
description: ""
---
# `danog\AsyncOrm\Settings\Redis`
[Back to index](../../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
Redis backend settings.
## Constants
* `danog\AsyncOrm\Settings\Redis::DEFAULT_CACHE_TTL`:
## Properties
* `$config`: `\Amp\Redis\RedisConfig`
* `$serializer`: `\danog\AsyncOrm\Serializer`
* `$cacheTtl`: `int<0, max>` For how long to keep records in memory after last read.
## Method list:
* [`__construct(\Amp\Redis\RedisConfig $config, ?\danog\AsyncOrm\Serializer $serializer = NULL, int<\0, \max> $cacheTtl = \self::DEFAULT_CACHE_TTL)`](#__construct-amp-redis-redisconfig-config-danog-asyncorm-serializer-serializer-null-int-0-max-cachettl-self-default_cache_ttl)
* [`getDriverClass(): string`](#getdriverclass-string)
## Methods:
### `__construct(\Amp\Redis\RedisConfig $config, ?\danog\AsyncOrm\Serializer $serializer = NULL, int<\0, \max> $cacheTtl = \self::DEFAULT_CACHE_TTL)`
Parameters:
* `$config`: `\Amp\Redis\RedisConfig`
* `$serializer`: `?\danog\AsyncOrm\Serializer` to use for object and mixed type values, if null defaults to either Igbinary or Native.
* `$cacheTtl`: `int<\0, \max>` Cache TTL in seconds
#### See also:
* `\Amp\Redis\RedisConfig`
* [`\danog\AsyncOrm\Serializer`: Serializer interface.](../../../danog/AsyncOrm/Serializer.md)
* `\max`
### `getDriverClass(): string`
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,71 @@
---
title: "danog\\AsyncOrm\\Settings\\SqlSettings: Generic SQL db backend settings."
description: ""
---
# `danog\AsyncOrm\Settings\SqlSettings`
[Back to index](../../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
Generic SQL db backend settings.
## Constants
* `danog\AsyncOrm\Settings\SqlSettings::DEFAULT_SQL_MAX_CONNECTIONS`:
* `danog\AsyncOrm\Settings\SqlSettings::DEFAULT_SQL_IDLE_TIMEOUT`:
* `danog\AsyncOrm\Settings\SqlSettings::DEFAULT_CACHE_TTL`:
## Properties
* `$maxConnections`: `positive-int`
* `$idleTimeout`: `positive-int`
* `$config`: `\T`
* `$serializer`: `\danog\AsyncOrm\Serializer`
* `$cacheTtl`: `int<0, max>` For how long to keep records in memory after last read.
## Method list:
* [`__construct(\Amp\Sql\SqlConfig $config, ?\danog\AsyncOrm\Serializer $serializer, int<\0, \max> $cacheTtl = \self::DEFAULT_CACHE_TTL, int<\1, \max> $maxConnections = \self::DEFAULT_SQL_MAX_CONNECTIONS, int<\1, \max> $idleTimeout = \self::DEFAULT_SQL_IDLE_TIMEOUT)`](#__construct-amp-sql-sqlconfig-config-danog-asyncorm-serializer-serializer-int-0-max-cachettl-self-default_cache_ttl-int-1-max-maxconnections-self-default_sql_max_connections-int-1-max-idletimeout-self-default_sql_idle_timeout)
* [`getDriverClass(): class-string<\danog\AsyncOrm\DbArray>`](#getdriverclass-class-string-danog-asyncorm-dbarray)
## Methods:
### `__construct(\Amp\Sql\SqlConfig $config, ?\danog\AsyncOrm\Serializer $serializer, int<\0, \max> $cacheTtl = \self::DEFAULT_CACHE_TTL, int<\1, \max> $maxConnections = \self::DEFAULT_SQL_MAX_CONNECTIONS, int<\1, \max> $idleTimeout = \self::DEFAULT_SQL_IDLE_TIMEOUT)`
Parameters:
* `$config`: `\Amp\Sql\SqlConfig`
* `$serializer`: `?\danog\AsyncOrm\Serializer` to use for object and mixed type values.
* `$cacheTtl`: `int<\0, \max>` Cache TTL in seconds
* `$maxConnections`: `int<\1, \max>` Maximum connection limit
* `$idleTimeout`: `int<\1, \max>` Idle timeout
#### See also:
* `\Amp\Sql\SqlConfig`
* [`\danog\AsyncOrm\Serializer`: Serializer interface.](../../../danog/AsyncOrm/Serializer.md)
* `\max`
### `getDriverClass(): class-string<\danog\AsyncOrm\DbArray>`
#### See also:
* [`\danog\AsyncOrm\DbArray`: DB array interface.](../../../danog/AsyncOrm/DbArray.md)
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

View File

@ -0,0 +1,72 @@
---
title: "danog\\AsyncOrm\\ValueType: Specifies the serializer to use when saving values."
description: ""
---
# `danog\AsyncOrm\ValueType`
[Back to index](../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
> Author: Alexander Pankratov <alexander@i-c-a.su>
Specifies the serializer to use when saving values.
## Constants
* `danog\AsyncOrm\ValueType::STRING`: Direct storage of UTF-8 string values.
* `danog\AsyncOrm\ValueType::INT`: Direct storage of integer values.
* `danog\AsyncOrm\ValueType::BOOL`: Direct storage of boolean values.
* `danog\AsyncOrm\ValueType::FLOAT`: Direct storage of floating point (double precision) values.
* `danog\AsyncOrm\ValueType::OBJECT`: Objects extending DbObject, serialized as specified in the settings.
* `danog\AsyncOrm\ValueType::SCALAR`: Values of any scalar type, serialized as specified in the settings.
Using SCALAR worsens performances, please use any of the other types possible.
## Properties
* `$name`: `string`
* `$value`: `string`
## Method list:
* [`cases(): array`](#cases-array)
* [`from(string|int $value): static`](#from-string-int-value-static)
* [`tryFrom(string|int $value): ?static`](#tryfrom-string-int-value-static)
## Methods:
### `cases(): array`
### `from(string|int $value): static`
Parameters:
* `$value`: `string|int`
### `tryFrom(string|int $value): ?static`
Parameters:
* `$value`: `string|int`
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)

41
docs/index.md Normal file
View File

@ -0,0 +1,41 @@
---
description: "Async ORM based on AMPHP v3 and fibers."
title: "danog/async-orm"
---
# `danog/async-orm`
Async ORM based on AMPHP v3 and fibers.
## Abstract classes
* [\danog\AsyncOrm\DbArray: DB array interface.](danog/AsyncOrm/DbArray.md)
* [\danog\AsyncOrm\DbObject](danog/AsyncOrm/DbObject.md)
* [\danog\AsyncOrm\Serializer: Serializer interface.](danog/AsyncOrm/Serializer.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\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\SqlSettings: Generic SQL db backend settings.](danog/AsyncOrm/Settings/SqlSettings.md)
## Classes
* [\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\ValueType: Specifies the serializer to use when saving values.](danog/AsyncOrm/ValueType.md)
* [\danog\AsyncOrm\Annotations\OrmMappedArray](danog/AsyncOrm/Annotations/OrmMappedArray.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\Json: JSON serializer.](danog/AsyncOrm/Serializer/Json.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\Mysql: MySQL backend settings.](danog/AsyncOrm/Settings/Mysql.md)
* [\danog\AsyncOrm\Settings\Postgres: Postgres backend settings.](danog/AsyncOrm/Settings/Postgres.md)
* [\danog\AsyncOrm\Settings\Redis: Redis backend settings.](danog/AsyncOrm/Settings/Redis.md)
## Traits
* [\danog\AsyncOrm\DbAutoProperties](danog/AsyncOrm/DbAutoProperties.md)
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it).

View File

@ -4,12 +4,12 @@ use Amp\Mysql\MysqlConfig;
use danog\AsyncOrm\DbObject;
use danog\AsyncOrm\FieldConfig;
use danog\AsyncOrm\KeyType;
use danog\AsyncOrm\Settings\Mysql;
use danog\AsyncOrm\Settings\MysqlSettings;
use danog\AsyncOrm\ValueType;
require __DIR__ . '/../vendor/autoload.php';
$settings = new Mysql(
$settings = new MysqlSettings(
new MysqlConfig("/var/run/mysqld/mysqld.sock", 0, 'daniil', database: 'test'),
);

19
infection.json5 Normal file
View File

@ -0,0 +1,19 @@
{
"$schema": "vendor/infection/infection/resources/schema.json",
"source": {
"directories": [
"src"
]
},
"timeout": 10,
"logs": {
"text": "infection/infection.log",
"html": "infection/infection.html",
"summary": "infection/summary.log",
"perMutator": "infection/per-mutator.md"
},
"tmpDir": ".infection-cache",
"mutators": {
"@default": true
}
}

View File

@ -21,7 +21,7 @@ namespace danog\AsyncOrm;
use danog\AsyncOrm\Annotations\OrmMappedArray;
use danog\AsyncOrm\Internal\Driver\CachedArray;
use danog\AsyncOrm\Settings\DriverSettings;
use danog\AsyncOrm\Settings\Mysql;
use danog\AsyncOrm\Settings\MysqlSettings;
use ReflectionClass;
use function Amp\async;
@ -55,7 +55,7 @@ trait DbAutoProperties
['cacheTtl' => $ttl]
));
}
if ($settings instanceof Mysql) {
if ($settings instanceof MysqlSettings) {
$optimize = $attr->optimizeIfWastedMb ?? $settings->optimizeIfWastedMb;
if ($optimize !== $settings->optimizeIfWastedMb) {

View File

@ -21,7 +21,6 @@ namespace danog\AsyncOrm\Driver;
use ArrayIterator;
use danog\AsyncOrm\DbArray;
use danog\AsyncOrm\FieldConfig;
use danog\AsyncOrm\Settings\Database\Memory;
/**
* Memory database backend.

View File

@ -7,7 +7,7 @@ use danog\AsyncOrm\Internal\Driver\CachedArray;
use danog\AsyncOrm\Internal\Driver\ObjectArray;
use danog\AsyncOrm\Serializer\Json;
use danog\AsyncOrm\Settings\DriverSettings;
use danog\AsyncOrm\Settings\Memory;
use danog\AsyncOrm\Settings\MemorySettings;
/**
* Contains configuration for a single ORM field.
@ -50,7 +50,7 @@ final readonly class FieldConfig
}
return ObjectArray::getInstance($this, $previous);
}
if ($this->settings instanceof Memory
if ($this->settings instanceof MemorySettings
|| (
$this->settings instanceof DriverSettings
&& $this->settings->cacheTtl === 0

View File

@ -59,7 +59,7 @@ final class MysqlArray extends SqlArray
public function __construct(FieldConfig $config, Serializer $serializer)
{
$settings = $config->settings;
\assert($settings instanceof \danog\AsyncOrm\Settings\Mysql);
\assert($settings instanceof \danog\AsyncOrm\Settings\MysqlSettings);
self::$mutex ??= new LocalKeyedMutex;
$dbKey = $settings->getDbIdentifier();

View File

@ -26,7 +26,7 @@ use danog\AsyncOrm\Internal\Serializer\ByteaSerializer;
use danog\AsyncOrm\Internal\Serializer\Passthrough;
use danog\AsyncOrm\KeyType;
use danog\AsyncOrm\Serializer;
use danog\AsyncOrm\Settings\Postgres;
use danog\AsyncOrm\Settings\PostgresSettings;
use danog\AsyncOrm\ValueType;
use Revolt\EventLoop;
@ -52,7 +52,7 @@ class PostgresArray extends SqlArray
{
self::$mutex ??= new LocalKeyedMutex;
$settings = $config->settings;
\assert($settings instanceof Postgres);
\assert($settings instanceof PostgresSettings);
$dbKey = $settings->getDbIdentifier();
$lock = self::$mutex->acquire($dbKey);

View File

@ -29,7 +29,7 @@ use danog\AsyncOrm\Internal\Serializer\IntString;
use danog\AsyncOrm\Internal\Serializer\Passthrough;
use danog\AsyncOrm\KeyType;
use danog\AsyncOrm\Serializer;
use danog\AsyncOrm\Settings\Redis;
use danog\AsyncOrm\Settings\RedisSettings;
use danog\AsyncOrm\ValueType;
use Revolt\EventLoop;
@ -71,7 +71,7 @@ final class RedisArray extends DriverArray
parent::__construct($config, $serializer);
self::$mutex ??= new LocalKeyedMutex;
\assert($config->settings instanceof Redis);
\assert($config->settings instanceof RedisSettings);
$dbKey = $config->settings->getDbIdentifier();
$lock = self::$mutex->acquire($dbKey);

View File

@ -22,7 +22,7 @@ use danog\AsyncOrm\Serializer\Native;
use danog\AsyncOrm\Settings;
/**
* Base class for database backends.
* Base settings class for database backends.
*/
abstract readonly class DriverSettings implements Settings
{

View File

@ -20,9 +20,9 @@ use danog\AsyncOrm\Driver\MemoryArray;
use danog\AsyncOrm\Settings;
/**
* Memory backend settings.
* MemorySettings backend settings.
*/
final readonly class Memory implements Settings
final readonly class MemorySettings implements Settings
{
public function getDriverClass(): string
{

View File

@ -27,7 +27,7 @@ use danog\AsyncOrm\Serializer;
*
* @extends SqlSettings<MysqlConfig>
*/
final readonly class Mysql extends SqlSettings
final readonly class MysqlSettings extends SqlSettings
{
/**
* @api

View File

@ -24,7 +24,7 @@ use danog\AsyncOrm\Serializer;
* Postgres backend settings.
* @extends SqlSettings<PostgresConfig>
*/
final readonly class Postgres extends SqlSettings
final readonly class PostgresSettings extends SqlSettings
{
/**
* @api

View File

@ -23,7 +23,7 @@ use danog\AsyncOrm\Serializer;
/**
* Redis backend settings.
*/
final readonly class Redis extends DriverSettings
final readonly class RedisSettings extends DriverSettings
{
/**
* @api

View File

@ -14,7 +14,7 @@
* @link https://daniil.it/AsyncOrm AsyncOrm documentation
*/
namespace danog\AsyncOrm\Test;
namespace danog\TestAsyncOrm;
use Amp\ByteStream\ReadableStream;
use Amp\DeferredFuture;
@ -34,10 +34,10 @@ use danog\AsyncOrm\Serializer\Json;
use danog\AsyncOrm\Serializer\Native;
use danog\AsyncOrm\Settings;
use danog\AsyncOrm\Settings\DriverSettings;
use danog\AsyncOrm\Settings\Memory;
use danog\AsyncOrm\Settings\Mysql;
use danog\AsyncOrm\Settings\Postgres;
use danog\AsyncOrm\Settings\Redis;
use danog\AsyncOrm\Settings\MemorySettings;
use danog\AsyncOrm\Settings\MysqlSettings;
use danog\AsyncOrm\Settings\PostgresSettings;
use danog\AsyncOrm\Settings\RedisSettings;
use danog\AsyncOrm\ValueType;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
@ -354,7 +354,7 @@ final class OrmTest extends TestCase
$field = new FieldConfig(
$table.'_new',
new Memory,
new MemorySettings,
KeyType::INT,
ValueType::INT
);
@ -566,26 +566,26 @@ final class OrmTest extends TestCase
public static function provideSettings(): \Generator
{
$key = 0;
yield [$key++, new Memory()];
yield [$key++, new MemorySettings()];
foreach ([new Native, new Igbinary, new Json] as $serializer) {
foreach ([0, 100] as $ttl) {
yield from [
[$key++, new Redis(
[$key++, new RedisSettings(
RedisConfig::fromUri('redis://127.0.0.1'),
$serializer,
$ttl,
)],
[$key++, new Postgres(
[$key++, new PostgresSettings(
PostgresConfig::fromString('host=127.0.0.1:5432 user=postgres db=test'),
$serializer,
$ttl,
)],
[$key++, new Mysql(
[$key++, new MysqlSettings(
MysqlConfig::fromString('host=127.0.0.1:3306 user=root db=test'),
$serializer,
$ttl,
)],
[$key++, new Mysql(
[$key++, new MysqlSettings(
MysqlConfig::fromString('host=127.0.0.1:3306 user=root db=test'),
$serializer,
$ttl,

View File

@ -1,6 +1,6 @@
<?php declare(strict_types=1);
namespace danog\AsyncOrm\Test;
namespace danog\TestAsyncOrm;
use danog\AsyncOrm\Annotations\OrmMappedArray;
use danog\AsyncOrm\DbArray;