DataFramePrimitives
- Full name:
\MammothPHP\WoollyM\DataFramePrimitives
- This class is an Abstract class
Properties
defaultDataDriverClass
public static string $defaultDataDriverClass
- This property is static.
data
protected \MammothPHP\WoollyM\DataDrivers\DataDriverInterface $data
driverColumnModeText
public bool $driverColumnModeText
columnIndexes
protected array $columnIndexes
columnRepresentations
protected \WeakMap $columnRepresentations
driverIterator
protected ?\Iterator $driverIterator
columnNamesCache
protected ?array $columnNamesCache
forcedTypesCache
protected ?array $forcedTypesCache
Methods
insert
public insert(): \MammothPHP\WoollyM\Statements\Insert\Insert
- This method is abstract.
__construct
public __construct(array<int,array> $data = [], mixed $dataDriver = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$data | array<int,array> | Array data to ingest |
$dataDriver | mixed | - Class of custom driver to use. if null, the PhpArray (in-memory) driver will used. |
Throws:
__clone
public __clone(): mixed
addColumn
Adds a new column to the DataFrame. If column already exist, then nothing will happen.
public addColumn(string $columnName): static
Parameters:
Parameter | Type | Description |
---|---|---|
$columnName | string |
addColumns
Adds multiple columns to the DataFrame.
public addColumns(string[] $columnNames): static
Parameters:
Parameter | Type | Description |
---|---|---|
$columnNames | string[] |
removeColumn
Removes a column (and all associated data) from the DataFrame.
public removeColumn(string $columnName): static
Parameters:
Parameter | Type | Description |
---|---|---|
$columnName | string |
hasColumn
Returns a boolean of whether the specified column exists.
public hasColumn(\MammothPHP\WoollyM\Statements\Select\ColumnRepresentation|string $column): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$column | \MammothPHP\WoollyM\Statements\Select\ColumnRepresentation|string |
countColumns
Count unique columns already known
public countColumns(): int
columns
Return ColumnRepresentation Object extending Select object
public columns(): array<int,\MammothPHP\WoollyM\Statements\Select\ColumnRepresentation>
columnsNames
Get unique columns already known
public columnsNames(): array<int,string>
mustHaveColumn
Assertion that the DataFrame must have the column specified. If not then an exception is thrown.
public mustHaveColumn(string $columnName): static
Parameters:
Parameter | Type | Description |
---|---|---|
$columnName | string |
Throws:
getColumnKey
protected getColumnKey(string $columnName): int
Parameters:
Parameter | Type | Description |
---|---|---|
$columnName | string |
createColumnRepresentation
protected createColumnRepresentation(\MammothPHP\WoollyM\ColumnIndex $columnIndex): void
Parameters:
Parameter | Type | Description |
---|---|---|
$columnIndex | \MammothPHP\WoollyM\ColumnIndex |
addRecord
Add a record, providing an array indexed by column => value
public addRecord(array<string,mixed> $recordArray): static
Parameters:
Parameter | Type | Description |
---|---|---|
$recordArray | array<string,mixed> |
updateRecord
Update a record by record key. If key does not exist, record will be created.
public updateRecord(int $key, array $recordArray): static
Parameters:
Parameter | Type | Description |
---|---|---|
$key | int | |
$recordArray | array |
updateCell
public updateCell(int $recordKey, string $column, mixed $newValue): static
Parameters:
Parameter | Type | Description |
---|---|---|
$recordKey | int | |
$column | string | |
$newValue | mixed |
removeRecord
Remove a record by key
public removeRecord(int $key): static
Parameters:
Parameter | Type | Description |
---|---|---|
$key | int |
Throws:
getRecord
Get a record by key
public getRecord(int $key): array<string,array>
Parameters:
Parameter | Type | Description |
---|---|---|
$key | int |
getRecordAsArray
Get a record by key and return an array
public getRecordAsArray(int $key): array<string,array>
Parameters:
Parameter | Type | Description |
---|---|---|
$key | int |
recordKeyExist
Check if a record key exist
public recordKeyExist(int $recordKey): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$recordKey | int |
convertRecordToAbstract
protected convertRecordToAbstract(array $recordArray): array
Parameters:
Parameter | Type | Description |
---|---|---|
$recordArray | array |
convertAbstractToRecordObject
protected convertAbstractToRecordObject(array $abstractRecord): \MammothPHP\WoollyM\Record
Parameters:
Parameter | Type | Description |
---|---|---|
$abstractRecord | array |
Automatically generated on 2024-07-03