type_bridge.crud.manager¶
manager
¶
Base manager for CRUD operations.
BaseManager
¶
Bases: ABC
Abstract base manager for CRUD operations.
Provides shared functionality for TypeDBManager: - Connection and executor management - Query execution helpers - Common operations like all(), _execute()
TypeDBManager implements all abstract methods.
Initialize the manager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
connection
|
Connection
|
Database, Transaction, or TransactionContext |
required |
model_class
|
type[T]
|
Model class (Entity or Relation subclass) |
required |
Source code in type_bridge/crud/manager.py
all
¶
Get all instances of this type.
Syntactic sugar for get() with no filters.
Returns:
| Type | Description |
|---|---|
list[T]
|
List of all instances |
insert
abstractmethod
¶
Insert an instance into the database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance
|
T
|
Instance to insert |
required |
Returns:
| Type | Description |
|---|---|
T
|
The inserted instance (with _iid populated if successful) |
get
abstractmethod
¶
Get instances with optional filters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**filters
|
Any
|
Attribute filters (exact match) |
{}
|
Returns:
| Type | Description |
|---|---|
list[T]
|
List of matching instances |
update
abstractmethod
¶
Update an instance in the database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance
|
T
|
Instance with updated values |
required |
Returns:
| Type | Description |
|---|---|
T
|
The updated instance |
delete
abstractmethod
¶
Delete an instance from the database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance
|
T
|
Instance to delete |
required |
Returns:
| Type | Description |
|---|---|
T
|
The deleted instance |