diff --git a/composer.json b/composer.json index 0b7848d..211a794 100644 --- a/composer.json +++ b/composer.json @@ -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": [ diff --git a/docs/danog/AsyncOrm/Annotations/OrmMappedArray.md b/docs/danog/AsyncOrm/Annotations/OrmMappedArray.md new file mode 100644 index 0000000..0b75105 --- /dev/null +++ b/docs/danog/AsyncOrm/Annotations/OrmMappedArray.md @@ -0,0 +1,50 @@ +--- +title: "danog\\AsyncOrm\\Annotations\\OrmMappedArray: " +description: "" + +--- +# `danog\AsyncOrm\Annotations\OrmMappedArray` +[Back to index](../../../index.md) + +> Author: Daniil Gentili +> Author: Alexander Pankratov + + + + + + +## 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) diff --git a/docs/danog/AsyncOrm/DbArray.md b/docs/danog/AsyncOrm/DbArray.md new file mode 100644 index 0000000..6b73d07 --- /dev/null +++ b/docs/danog/AsyncOrm/DbArray.md @@ -0,0 +1,210 @@ +--- +title: "danog\\AsyncOrm\\DbArray: DB array interface." +description: "" + +--- +# `danog\AsyncOrm\DbArray` +[Back to index](../../index.md) + +> Author: Daniil Gentili +> Author: Alexander Pankratov + + +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) diff --git a/docs/danog/AsyncOrm/DbAutoProperties.md b/docs/danog/AsyncOrm/DbAutoProperties.md new file mode 100644 index 0000000..73e1d13 --- /dev/null +++ b/docs/danog/AsyncOrm/DbAutoProperties.md @@ -0,0 +1,47 @@ +--- +title: "danog\\AsyncOrm\\DbAutoProperties: " +description: "" + +--- +# `danog\AsyncOrm\DbAutoProperties` +[Back to index](../../index.md) + +> Author: Daniil Gentili +> Author: Alexander Pankratov + + + + + + + +## 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) diff --git a/docs/danog/AsyncOrm/DbObject.md b/docs/danog/AsyncOrm/DbObject.md new file mode 100644 index 0000000..3b786ba --- /dev/null +++ b/docs/danog/AsyncOrm/DbObject.md @@ -0,0 +1,29 @@ +--- +title: "danog\\AsyncOrm\\DbObject: " +description: "" + +--- +# `danog\AsyncOrm\DbObject` +[Back to index](../../index.md) + +> Author: Daniil Gentili +> Author: Alexander Pankratov + + + + + + + +## Method list: +* [`save(): void`](#save-void) + +## Methods: +### `save(): void` + +Save object to database. + + + +--- +Generated by [danog/phpdoc](https://phpdoc.daniil.it) diff --git a/docs/danog/AsyncOrm/Driver/DriverArray.md b/docs/danog/AsyncOrm/Driver/DriverArray.md new file mode 100644 index 0000000..338753a --- /dev/null +++ b/docs/danog/AsyncOrm/Driver/DriverArray.md @@ -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 +> Author: Alexander Pankratov + + +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) diff --git a/docs/danog/AsyncOrm/Driver/MemoryArray.md b/docs/danog/AsyncOrm/Driver/MemoryArray.md new file mode 100644 index 0000000..631dd50 --- /dev/null +++ b/docs/danog/AsyncOrm/Driver/MemoryArray.md @@ -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 +> Author: Alexander Pankratov + + +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) diff --git a/docs/danog/AsyncOrm/Driver/SqlArray.md b/docs/danog/AsyncOrm/Driver/SqlArray.md new file mode 100644 index 0000000..0c97f6d --- /dev/null +++ b/docs/danog/AsyncOrm/Driver/SqlArray.md @@ -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 +> Author: Alexander Pankratov + + +Generic SQL database backend. + + + + +## Method list: +* [`getIterator(): \Traversable`](#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` + +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) diff --git a/docs/danog/AsyncOrm/FieldConfig.md b/docs/danog/AsyncOrm/FieldConfig.md new file mode 100644 index 0000000..c547253 --- /dev/null +++ b/docs/danog/AsyncOrm/FieldConfig.md @@ -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 +> Author: Alexander Pankratov + + +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) diff --git a/docs/danog/AsyncOrm/KeyType.md b/docs/danog/AsyncOrm/KeyType.md new file mode 100644 index 0000000..7dbc0fa --- /dev/null +++ b/docs/danog/AsyncOrm/KeyType.md @@ -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 +> Author: Alexander Pankratov + + +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) diff --git a/docs/danog/AsyncOrm/Serializer.md b/docs/danog/AsyncOrm/Serializer.md new file mode 100644 index 0000000..50bd31e --- /dev/null +++ b/docs/danog/AsyncOrm/Serializer.md @@ -0,0 +1,56 @@ +--- +title: "danog\\AsyncOrm\\Serializer: Serializer interface." +description: "" + +--- +# `danog\AsyncOrm\Serializer` +[Back to index](../../index.md) + +> Author: Daniil Gentili +> Author: Alexander Pankratov + + +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) diff --git a/docs/danog/AsyncOrm/Serializer/Igbinary.md b/docs/danog/AsyncOrm/Serializer/Igbinary.md new file mode 100644 index 0000000..084e97d --- /dev/null +++ b/docs/danog/AsyncOrm/Serializer/Igbinary.md @@ -0,0 +1,46 @@ +--- +title: "danog\\AsyncOrm\\Serializer\\Igbinary: Igbinary serializer." +description: "" + +--- +# `danog\AsyncOrm\Serializer\Igbinary` +[Back to index](../../../index.md) + +> Author: Daniil Gentili +> Author: Alexander Pankratov + + +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) diff --git a/docs/danog/AsyncOrm/Serializer/Json.md b/docs/danog/AsyncOrm/Serializer/Json.md new file mode 100644 index 0000000..03571e7 --- /dev/null +++ b/docs/danog/AsyncOrm/Serializer/Json.md @@ -0,0 +1,46 @@ +--- +title: "danog\\AsyncOrm\\Serializer\\Json: JSON serializer." +description: "" + +--- +# `danog\AsyncOrm\Serializer\Json` +[Back to index](../../../index.md) + +> Author: Daniil Gentili +> Author: Alexander Pankratov + + +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) diff --git a/docs/danog/AsyncOrm/Serializer/Native.md b/docs/danog/AsyncOrm/Serializer/Native.md new file mode 100644 index 0000000..94a53a2 --- /dev/null +++ b/docs/danog/AsyncOrm/Serializer/Native.md @@ -0,0 +1,46 @@ +--- +title: "danog\\AsyncOrm\\Serializer\\Native: Native serializer." +description: "" + +--- +# `danog\AsyncOrm\Serializer\Native` +[Back to index](../../../index.md) + +> Author: Daniil Gentili +> Author: Alexander Pankratov + + +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) diff --git a/docs/danog/AsyncOrm/Settings.md b/docs/danog/AsyncOrm/Settings.md new file mode 100644 index 0000000..a41f01d --- /dev/null +++ b/docs/danog/AsyncOrm/Settings.md @@ -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 +> Author: Alexander Pankratov + + +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) diff --git a/docs/danog/AsyncOrm/Settings/DriverSettings.md b/docs/danog/AsyncOrm/Settings/DriverSettings.md new file mode 100644 index 0000000..6ad2baa --- /dev/null +++ b/docs/danog/AsyncOrm/Settings/DriverSettings.md @@ -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 +> Author: Alexander Pankratov + + +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) diff --git a/docs/danog/AsyncOrm/Settings/Memory.md b/docs/danog/AsyncOrm/Settings/Memory.md new file mode 100644 index 0000000..f03f1e2 --- /dev/null +++ b/docs/danog/AsyncOrm/Settings/Memory.md @@ -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 +> Author: Alexander Pankratov + + +Memory backend settings. + + + + +## Method list: +* [`getDriverClass(): string`](#getdriverclass-string) + +## Methods: +### `getDriverClass(): string` + + + + + +--- +Generated by [danog/phpdoc](https://phpdoc.daniil.it) diff --git a/docs/danog/AsyncOrm/Settings/Mysql.md b/docs/danog/AsyncOrm/Settings/Mysql.md new file mode 100644 index 0000000..41e4496 --- /dev/null +++ b/docs/danog/AsyncOrm/Settings/Mysql.md @@ -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 +> Author: Alexander Pankratov + + +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) diff --git a/docs/danog/AsyncOrm/Settings/Postgres.md b/docs/danog/AsyncOrm/Settings/Postgres.md new file mode 100644 index 0000000..5a586ca --- /dev/null +++ b/docs/danog/AsyncOrm/Settings/Postgres.md @@ -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 +> Author: Alexander Pankratov + + +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) diff --git a/docs/danog/AsyncOrm/Settings/Redis.md b/docs/danog/AsyncOrm/Settings/Redis.md new file mode 100644 index 0000000..b3392e0 --- /dev/null +++ b/docs/danog/AsyncOrm/Settings/Redis.md @@ -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 +> Author: Alexander Pankratov + + +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) diff --git a/docs/danog/AsyncOrm/Settings/SqlSettings.md b/docs/danog/AsyncOrm/Settings/SqlSettings.md new file mode 100644 index 0000000..fc8147d --- /dev/null +++ b/docs/danog/AsyncOrm/Settings/SqlSettings.md @@ -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 +> Author: Alexander Pankratov + + +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) diff --git a/docs/danog/AsyncOrm/ValueType.md b/docs/danog/AsyncOrm/ValueType.md new file mode 100644 index 0000000..6fbda1e --- /dev/null +++ b/docs/danog/AsyncOrm/ValueType.md @@ -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 +> Author: Alexander Pankratov + + +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) diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..c3f4dfe --- /dev/null +++ b/docs/index.md @@ -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). \ No newline at end of file diff --git a/examples/1-basic.php b/examples/1-basic.php index 6658f2a..8bedde4 100644 --- a/examples/1-basic.php +++ b/examples/1-basic.php @@ -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'), ); diff --git a/infection.json5 b/infection.json5 new file mode 100644 index 0000000..4439301 --- /dev/null +++ b/infection.json5 @@ -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 + } +} diff --git a/src/DbAutoProperties.php b/src/DbAutoProperties.php index 6922261..320602b 100644 --- a/src/DbAutoProperties.php +++ b/src/DbAutoProperties.php @@ -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) { diff --git a/src/Driver/MemoryArray.php b/src/Driver/MemoryArray.php index 62b9fa0..5dda9f6 100644 --- a/src/Driver/MemoryArray.php +++ b/src/Driver/MemoryArray.php @@ -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. diff --git a/src/FieldConfig.php b/src/FieldConfig.php index 425e84e..dd3e6e2 100644 --- a/src/FieldConfig.php +++ b/src/FieldConfig.php @@ -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 diff --git a/src/Internal/Driver/MysqlArray.php b/src/Internal/Driver/MysqlArray.php index 9cdcbc1..f9bf81c 100644 --- a/src/Internal/Driver/MysqlArray.php +++ b/src/Internal/Driver/MysqlArray.php @@ -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(); diff --git a/src/Internal/Driver/PostgresArray.php b/src/Internal/Driver/PostgresArray.php index fd6034d..1c30a5b 100644 --- a/src/Internal/Driver/PostgresArray.php +++ b/src/Internal/Driver/PostgresArray.php @@ -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); diff --git a/src/Internal/Driver/RedisArray.php b/src/Internal/Driver/RedisArray.php index 7bb8ed1..acd8d81 100644 --- a/src/Internal/Driver/RedisArray.php +++ b/src/Internal/Driver/RedisArray.php @@ -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); diff --git a/src/Settings/DriverSettings.php b/src/Settings/DriverSettings.php index ab6a4c9..a041fe0 100644 --- a/src/Settings/DriverSettings.php +++ b/src/Settings/DriverSettings.php @@ -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 { diff --git a/src/Settings/Memory.php b/src/Settings/MemorySettings.php similarity index 92% rename from src/Settings/Memory.php rename to src/Settings/MemorySettings.php index 1ebebcd..0888e42 100644 --- a/src/Settings/Memory.php +++ b/src/Settings/MemorySettings.php @@ -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 { diff --git a/src/Settings/Mysql.php b/src/Settings/MysqlSettings.php similarity index 97% rename from src/Settings/Mysql.php rename to src/Settings/MysqlSettings.php index 659aa9f..4241d5c 100644 --- a/src/Settings/Mysql.php +++ b/src/Settings/MysqlSettings.php @@ -27,7 +27,7 @@ use danog\AsyncOrm\Serializer; * * @extends SqlSettings */ -final readonly class Mysql extends SqlSettings +final readonly class MysqlSettings extends SqlSettings { /** * @api diff --git a/src/Settings/Postgres.php b/src/Settings/PostgresSettings.php similarity index 97% rename from src/Settings/Postgres.php rename to src/Settings/PostgresSettings.php index 8715662..27cf10e 100644 --- a/src/Settings/Postgres.php +++ b/src/Settings/PostgresSettings.php @@ -24,7 +24,7 @@ use danog\AsyncOrm\Serializer; * Postgres backend settings. * @extends SqlSettings */ -final readonly class Postgres extends SqlSettings +final readonly class PostgresSettings extends SqlSettings { /** * @api diff --git a/src/Settings/Redis.php b/src/Settings/RedisSettings.php similarity index 96% rename from src/Settings/Redis.php rename to src/Settings/RedisSettings.php index aa0577a..b7f6d6d 100644 --- a/src/Settings/Redis.php +++ b/src/Settings/RedisSettings.php @@ -23,7 +23,7 @@ use danog\AsyncOrm\Serializer; /** * Redis backend settings. */ -final readonly class Redis extends DriverSettings +final readonly class RedisSettings extends DriverSettings { /** * @api diff --git a/tests/OrmTest.php b/tests/OrmTest.php index 3479d7d..8f29737 100644 --- a/tests/OrmTest.php +++ b/tests/OrmTest.php @@ -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, diff --git a/tests/TestObject.php b/tests/TestObject.php index a136931..5f6cdfb 100644 --- a/tests/TestObject.php +++ b/tests/TestObject.php @@ -1,6 +1,6 @@