ADocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Indroic/HexCore/llms.txt
Use this file to discover all available pages before exploring further.
Command represents an intent to change state. In CQRS, write-side messages are modelled as commands: each command has a clear name, carries all the data needed to perform the operation, and is dispatched to exactly one handler. HexCore’s Command base class enforces immutability (frozen=True) so command objects cannot be accidentally mutated after construction, making them safe to pass through middleware pipelines and serialize for background queues.
Class definition
Fields
A unique identifier auto-generated for every command instance. Useful for idempotency checks, distributed tracing, and deduplication in task queues.
UTC creation time of the command, set automatically via
datetime.now(UTC). Useful for auditing and ordering in async systems.Model configuration
| Option | Value | Effect |
|---|---|---|
frozen | True | All fields become read-only after instantiation. Attempts to mutate a field raise a ValidationError. The command is also hashable, enabling use in sets or as dict keys. |
from_attributes | True | Allows constructing a command from ORM objects or other attribute-bearing objects via Command.model_validate(obj). |
Type aliases
A type variable bound to
Command. Use this when declaring a generic handler to constrain the handler to a specific command subclass.An unconstrained type variable for the return value of a command handler. Use
None for fire-and-forget commands that produce no meaningful result.