/** * * FunctionTraits.h * An Tao * * Copyright 2018, An Tao. All rights reserved. * https://github.com/an-tao/drogon * Use of this source code is governed by a MIT license * that can be found in the License file. * * Drogon * */ #pragma once #include #include #include #include namespace drogon { namespace orm { class Result; class DrogonDbException; namespace internal { template struct FunctionTraits; template <> struct FunctionTraits { using result_type = void; template using argument = void; static const std::size_t arity = 0; static const bool isSqlCallback = false; static const bool isExceptCallback = false; }; // functor,lambda template struct FunctionTraits : public FunctionTraits::type::operator())> { }; template struct FunctionTraits : FunctionTraits { }; template struct FunctionTraits : FunctionTraits { }; template <> struct FunctionTraits : public FunctionTraits { static const bool isSqlCallback = true; static const bool isStepResultCallback = false; static const bool isExceptCallback = false; }; template <> struct FunctionTraits : public FunctionTraits { static const bool isExceptCallback = true; static const bool isSqlCallback = false; static const bool isStepResultCallback = false; static const bool isPtr = false; }; template <> struct FunctionTraits : public FunctionTraits { static const bool isExceptCallback = true; static const bool isSqlCallback = false; static const bool isStepResultCallback = false; static const bool isPtr = true; }; template struct FunctionTraits : FunctionTraits { static const bool isSqlCallback = true; static const bool isStepResultCallback = true; }; template struct FunctionTraits { using result_type = ReturnType; template using argument = typename std::tuple_element>::type; static const std::size_t arity = sizeof...(Arguments); // static const bool isSqlCallback = false; static const bool isSqlCallback = true; static const bool isStepResultCallback = true; }; } // namespace internal } // namespace orm } // namespace drogon