initial matador ng commit
This commit is contained in:
@@ -1,27 +1,72 @@
|
||||
#ifndef QUERY_FIELD_ATTRIBUTES_HPP
|
||||
#define QUERY_FIELD_ATTRIBUTES_HPP
|
||||
#ifndef MATADOR_FIELD_ATTRIBUTES_HPP
|
||||
#define MATADOR_FIELD_ATTRIBUTES_HPP
|
||||
|
||||
#include "constraints.hpp"
|
||||
#include "matador/utils/constraints.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstddef>
|
||||
|
||||
namespace matador::utils {
|
||||
|
||||
/**
|
||||
* This class represents field attributes in
|
||||
* form of size and constraints for a database
|
||||
* field (column)
|
||||
*
|
||||
* Currently the size is only applied
|
||||
* to a field of type string leading
|
||||
* to VARCHAR(size).
|
||||
*/
|
||||
class field_attributes
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Creates field_attributes instance
|
||||
* with size 0 (zero) and no constraints.
|
||||
*/
|
||||
field_attributes() = default;
|
||||
/**
|
||||
* Creates field_attributes instance
|
||||
* with given size and no constraints.
|
||||
*
|
||||
* @param size Size of the attribute
|
||||
*/
|
||||
field_attributes(size_t size); // NOLINT(*-explicit-constructor)
|
||||
/**
|
||||
* Creates field_attributes instance
|
||||
* with size 0 (zero) and given constraints.
|
||||
*
|
||||
* @param options Constraints to apply to field
|
||||
*/
|
||||
field_attributes(constraints options); // NOLINT(*-explicit-constructor)
|
||||
/**
|
||||
* Creates field_attributes instance
|
||||
* with given size and constraints.
|
||||
*
|
||||
* @param size Size of the attribute
|
||||
* @param options Constraints to apply to field
|
||||
*/
|
||||
field_attributes(size_t size, constraints options);
|
||||
field_attributes(const field_attributes &x) = default;
|
||||
field_attributes& operator=(const field_attributes &x) = default;
|
||||
field_attributes(field_attributes &&x) = default;
|
||||
field_attributes& operator=(field_attributes &&x) = default;
|
||||
~field_attributes() = default;
|
||||
|
||||
field_attributes(const field_attributes &) = default;
|
||||
field_attributes(field_attributes &&) = default;
|
||||
field_attributes &operator=(const field_attributes &) = default;
|
||||
field_attributes &operator=(field_attributes &&) = default;
|
||||
|
||||
field_attributes& operator=(size_t size);
|
||||
field_attributes& operator=(constraints opt);
|
||||
/**
|
||||
* Returns the size of the field
|
||||
*
|
||||
* @return Size of the field
|
||||
*/
|
||||
[[nodiscard]] size_t size() const;
|
||||
void size(size_t size);
|
||||
|
||||
/**
|
||||
* Returns the constraints of the field
|
||||
*
|
||||
* @return Constraints of the field
|
||||
*/
|
||||
[[nodiscard]] constraints options() const;
|
||||
|
||||
private:
|
||||
@@ -32,4 +77,4 @@ private:
|
||||
const field_attributes null_attributes {};
|
||||
|
||||
}
|
||||
#endif //QUERY_FIELD_ATTRIBUTES_HPP
|
||||
#endif //MATADOR_FIELD_ATTRIBUTES_HPP
|
||||
|
||||
Reference in New Issue
Block a user