|
- #pragma once
-
- namespace cpphibernate {
- namespace mariadb {
-
- struct field_t;
- struct table_t;
- struct schema_t;
-
- /**
- * @brief Inclusive or exclusive field and table filter.
- * Is used in update and read operations to select the fields that should be updated / fetched.
- */
- struct filter_t
- {
- public:
- using field_set_type = std::set<const field_t *>;
- using table_set_type = std::set<const table_t *>;
-
- ssize_t cache_id { 0 }; //!< Unique ID that indicates the current filtered tables and fields
- bool exclusive { true }; //!< True: Use exclusive filter. False: Use inclusive filter.
- field_set_type fields; //!< Set of fields assigned to the filter.
- table_set_type tables; //!< Set of tables assigned to the filter.
-
- public:
- /**
- * @brief Returns true if the passed table is excluded.
- */
- inline bool is_excluded(const table_t& table) const;
-
- /**
- * @brief Returns true if the passed field is excluded.
- */
- inline bool is_excluded(const field_t& field) const;
-
- /**
- * @brief Set included fields and tables.
- *
- * @param[in] schema Mariadb driver schame to use for looking up fields and tables.
- * @param[in] args Fields and tables from the cpphibernate schema to include in this filter.
- */
- template<typename... T_args>
- inline void set_inclusive(const schema_t& schema, T_args&&... args);
-
- /**
- * @brief Set excluded fields and tables.
- *
- * @param[in] schema Mariadb driver schame to use for looking up fields and tables.
- * @param[in] args Fields and tables from the cpphibernate schema to exclude in this filter.
- */
- template<typename... T_args>
- inline void set_exclusive(const schema_t& schema, T_args&&... args);
-
- /**
- * @brief Clear the filter.
- */
- inline void clear();
- };
-
- } }
|