This commit is contained in:
24
rediska/common/utils.hpp
Normal file
24
rediska/common/utils.hpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
#include "rediska/common/types.hpp"
|
||||
|
||||
template<typename T, typename... Ts>
|
||||
constexpr bool is_any_of_v = (std::is_same_v<T, Ts> || ...);
|
||||
|
||||
inline RediskaReturnCode DSReturnCodeToRediskaReturnCode(DSReturnCode code) {
|
||||
switch (code) {
|
||||
case DSReturnCode::OK:
|
||||
return RediskaReturnCode::OK;
|
||||
case DSReturnCode::NOT_FOUND:
|
||||
return RediskaReturnCode::NOT_FOUND;
|
||||
case DSReturnCode::INCOMPATIBLE_OPERATION:
|
||||
return RediskaReturnCode::INCOMPATIBLE_OPERATION;
|
||||
case DSReturnCode::EMPTY:
|
||||
return RediskaReturnCode::DS_EMPTY;
|
||||
case DSReturnCode::OUT_OF_RANGE:
|
||||
return RediskaReturnCode::DS_OUT_OF_RANGE;
|
||||
default:
|
||||
return RediskaReturnCode::UNKNOWN_ERROR;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user