Query.h 857 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef ORM_QUERY_H
  2. #define ORM_QUERY_H
  3. #include <vector>
  4. #include <boost/shared_ptr.hpp>
  5. #include <google/protobuf/message.h>
  6. #include "Base/Typedef.h"
  7. namespace Egametang {
  8. class SelectQuery
  9. {
  10. bool distinct;
  11. int limit;
  12. int offset;
  13. std::string where;
  14. std::string groupBy;
  15. std::string having;
  16. std::string orderBy;
  17. public:
  18. SelectQuery(): distinct(false), limit(0), offset(0), where("true")
  19. {
  20. }
  21. SelectQuery& Distinct(bool distinct);
  22. SelectQuery& Limit(int limit);
  23. SelectQuery& Offset(int offset);
  24. SelectQuery& Result(std::string result);
  25. SelectQuery& ClearResults();
  26. SelectQuery& Where(const Expr& where);
  27. SelectQuery& GroupBy(std::string groupby);
  28. SelectQuery& Having(const Expr& having);
  29. SelectQuery& OrderBy(Column column, bool ascending = true);
  30. std::string ToString() const
  31. {
  32. }
  33. };
  34. } // namespace Egametang
  35. #endif // ORM_QUERY_H