rail_pz_service.db.cli.wrappers module
Wrappers to create functions for the various parts of the CLI
These wrappers create functions that invoke interface functions that are defined in the db.row.RowMixin.
- rail_pz_service.db.cli.wrappers.get_create_command(group_command, db_class, create_options)[source]
Return a function that creates a new row in the table and attaches that function to the cli.
- Parameters:
group_command (Callable) – CLI decorator from the CLI group to attach to
db_class (TypeAlias = db.RowMixin) – Underlying database class
create_options (list[Callable]) – Command line options for the create function
- Returns:
Function that creates a row in the table
- Return type:
Callable
- rail_pz_service.db.cli.wrappers.get_delete_command(group_command, db_class)[source]
Return a function that delets a row in the table and attaches that function to the cli.
- Parameters:
group_command (Callable) – CLI decorator from the CLI group to attach to
db_class (TypeAlias = db.RowMixin) – Underlying database class
- Returns:
Function that deletes a row in the table
- Return type:
Callable
- rail_pz_service.db.cli.wrappers.get_list_command(group_command, db_class)[source]
Return a function that gets all the rows from a table and attaches that function to the cli.
This version will provide a function that always returns all the rows
- Parameters:
group_command (Callable) – CLI decorator from the CLI group to attach to
db_class (TypeAlias = db.RowMixin) – Underlying database class
- Returns:
Function that return all the rows for the table in question
- Return type:
Callable
- rail_pz_service.db.cli.wrappers.get_row_attribute_list_command(group_command, db_class, attribute, output_db_class)[source]
Return a function that gets a row from a table and attaches that function to the cli.
- Parameters:
group_command (Callable) – CLI decorator from the CLI group to attach to
db_class (TypeAlias) – Underlying database class
attribute (str) – The attribute to get
output_db_class (TypeAlias) – Db class for the output type
- Returns:
Function that returns the row for the table in question
- Return type:
Callable
- rail_pz_service.db.cli.wrappers.get_row_by_name_command(group_command, db_class)[source]
Return a function that gets a row from a table and attaches that function to the cli.
- Parameters:
group_command (Callable) – CLI decorator from the CLI group to attach to
db_class (TypeAlias = db.RowMixin) – Underlying database class
- Returns:
the_function – Function that returns the row for the table in question
- Return type:
Callable
- rail_pz_service.db.cli.wrappers.get_row_command(group_command, db_class)[source]
Return a function that gets a row from a table and attaches that function to the cli.
- Parameters:
group_command (Callable) – CLI decorator from the CLI group to attach to
db_class (TypeAlias = db.RowMixin) – Underlying database class
- Returns:
Function that returns the row for the table in question
- Return type:
Callable
- rail_pz_service.db.cli.wrappers.output_db_obj_list(db_objs, output, col_names)[source]
Render a sequences of objects as requested
- Parameters:
db_objs (Sequence[RowMixin]) – Objects in question
output (OutputEnum | None) – Output format
col_names (list[str]) – Names for columns in tabular representation
- Return type:
None
- rail_pz_service.db.cli.wrappers.output_db_object(db_obj, output, col_names)[source]
Render a single object as requested
- Parameters:
db_obj (RowMixin) – Object in question
output (OutputEnum | None) – Output format
col_names (list[str]) – Names for columns in tabular representation
- Return type:
None