simplelogincmd.cli.util.input.resolve_id

resolve_id(db, model_cls, id)

Search for a single db object id given an identifier

Call the model classes resolve_identifier() method to locate db objects based on the given identifier, which can be any value. If multiple results match, ask the user to choose one and return the selected object. If one result matches, return it directly. If no matches were found, return None.

Parameters:
  • db (DatabaseAccessLayer) – The access layer instance to use for the lookup

  • model_cls (Type, subclass of Object) – The type of db object for which to search

  • id (Any, usually int or str, as defined by the model class’s identifier_query()) – The id to look up

Returns:

The matched object, or None if none matched

Return type:

Object | None