From 53bc9f935f6def21da7b4f1b2feb07aaaef82292 Mon Sep 17 00:00:00 2001 From: JohnDoe6345789 Date: Fri, 26 Dec 2025 01:45:36 +0000 Subject: [PATCH] code: package,hpp,get (1 files) --- dbal/cpp/src/entities/package/get_package.hpp | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/dbal/cpp/src/entities/package/get_package.hpp b/dbal/cpp/src/entities/package/get_package.hpp index c2f7f64c8..ad1001957 100644 --- a/dbal/cpp/src/entities/package/get_package.hpp +++ b/dbal/cpp/src/entities/package/get_package.hpp @@ -1,6 +1,6 @@ /** * @file get_package.hpp - * @brief Get package by ID or package_id operations + * @brief Get package by ID or name+version key operations */ #ifndef DBAL_GET_PACKAGE_HPP #define DBAL_GET_PACKAGE_HPP @@ -20,28 +20,28 @@ inline Result get(InMemoryStore& store, const std::string& id) { if (id.empty()) { return Error::validationError("Package ID cannot be empty"); } - + auto it = store.packages.find(id); if (it == store.packages.end()) { return Error::notFound("Package not found: " + id); } - + return Result(it->second); } /** - * Get a package by package_id (snake_case identifier) + * Get a package by name+version key (name@version) */ -inline Result getByPackageId(InMemoryStore& store, const std::string& package_id) { - if (package_id.empty()) { - return Error::validationError("Package ID cannot be empty"); +inline Result getByPackageId(InMemoryStore& store, const std::string& package_key) { + if (package_key.empty()) { + return Error::validationError("Package key cannot be empty"); } - - auto it = store.package_ids.find(package_id); - if (it == store.package_ids.end()) { - return Error::notFound("Package not found: " + package_id); + + auto it = store.package_keys.find(package_key); + if (it == store.package_keys.end()) { + return Error::notFound("Package not found: " + package_key); } - + return get(store, it->second); }