HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_ORMFieldColumn Class Reference

#include <UT_ORMField.h>

+ Inheritance diagram for UT_ORMFieldColumn:

Public Member Functions

 UT_ORMFieldColumn (const UT_StringHolder &name, UT_UniquePtr< UT_IORMFieldAdapter > adapter, unsigned props=UT_ORMColumn::Properties::Empty, UT_ORMColumn::OnDelete ondelete=UT_ORMColumn::OnDelete::DoNothing, const UT_StringHolder &related_name=UT_StringHolder::theEmptyString)
 
 UT_ORMFieldColumn (const UT_StringHolder &name, UT_ORMColumn::Type type, unsigned props=UT_ORMColumn::Empty, UT_ORMColumn::OnDelete ondelete=UT_ORMColumn::OnDelete::DoNothing)
 
UT_IORMFieldAdapteradapter ()
 
UT_IORMFieldAdapteradapter () const
 
void setAsManyToMany (const UT_ORMModelMeta &through_meta, const UT_ORMModelMeta &meta, const UT_StringHolder &m2m_field_name, const UT_ORMModelMeta &foreign_meta, const UT_StringHolder &m2m_reverse_field_name, const UT_StringHolder &related_name=UT_StringHolder::theEmptyString)
 
bool verify (UT_SqlOrm *orm, UT_Error &ec, UT_StringHolder &err_msg)
 
void connectLinks (const UT_SharedPtr< UT_ORMModelMeta > &meta)
 
UT_SharedPtr< UT_ORMModelMetaforeignModel () const
 
const UT_StringHolderm2mFieldName () const
 
const UT_StringHolderm2mReverseFieldName () const
 
- Public Member Functions inherited from UT_ORMColumn
 UT_ORMColumn ()=default
 
 UT_ORMColumn (const UT_StringHolder &name, Type type, unsigned props=Properties::Empty, OnDelete on_delete=OnDelete::DoNothing)
 
bool operator== (const UT_ORMColumn &rhs) const
 
bool operator!= (const UT_ORMColumn &rhs) const
 
void sql (const UT_SqlStatement &stmt, UT_WorkBuffer &wbuf)
 
Type type () const
 
UT_ORMColumnsetName (const UT_StringHolder &name)
 
const UT_StringHoldername () const
 
UT_ORMColumnsetNotNull (bool not_null)
 
bool isNotNull () const
 
UT_ORMColumnsetPrimaryKey (bool pk)
 
bool isPrimaryKey () const
 
UT_ORMColumnsetUnique (bool upk)
 
bool isUnique () const
 
UT_ORMColumnsetAutoIncrement (bool inc)
 
bool isAutoIncrement () const
 
bool isTableColumn () const
 
bool isLocal () const
 
unsigned properties () const
 
OnDelete onDelete () const
 
void setOnDelete (OnDelete ondelete)
 
const UT_StringHoldertypeString (const UT_SqlStatement &cursor) const
 
bool isForeignKey () const
 
bool isManyToMany () const
 
void setAsForeignKey (const UT_StringHolder &foreign_model, const UT_StringHolder &table_name, const UT_StringHolder &col, UT_ORMColumn::OnDelete ondelete=UT_ORMColumn::OnDelete::Cascade, const UT_StringHolder &related_name=UT_StringHolder::theEmptyString)
 
void setAsForeignKey (const UT_StringHolder &foreign_model, const UT_StringHolder &table_name, const UT_StringArray &cols, UT_ORMColumn::OnDelete ondelete=UT_ORMColumn::OnDelete::Cascade, const UT_StringHolder &related_name=UT_StringHolder::theEmptyString)
 
void setAsForeignKey (const UT_ORMModelMeta &meta, const UT_StringHolder &col=UT_StringHolder::theEmptyString, UT_ORMColumn::OnDelete=UT_ORMColumn::OnDelete::Cascade, const UT_StringHolder &related_name=UT_StringHolder::theEmptyString)
 
const UT_StringHolderforeignTable () const
 
const UT_StringHolderforeignTableModelName () const
 
const UT_StringHolderforeignFieldName () const
 
const UT_StringArrayforeignColumns () const
 
bool isForeignKeyToModel (const UT_ORMModelMeta &model) const
 
void setRelatedName (const UT_StringHolder &related)
 
const UT_StringHolderrelatedName () const
 

Protected Attributes

UT_UniquePtr< UT_IORMFieldAdaptermyFieldPtr
 
UT_StringHolder myThroughModelName
 
UT_WeakPtr< UT_ORMModelMetamyForeignModel
 
UT_StringHolder myM2MFieldName
 
UT_StringHolder myM2MReverseFieldName
 
- Protected Attributes inherited from UT_ORMColumn
unsigned myProperties = Properties::Empty
 
OnDelete myOnDelete = OnDelete::DoNothing
 
Type myType
 
UT_StringHolder myName
 
UT_StringHolder myForeignTable
 
UT_StringHolder myForeignModelName
 
UT_StringArray myForeignColumns
 
UT_StringHolder myRelated
 

Additional Inherited Members

- Public Types inherited from UT_ORMColumn
enum  Properties {
  Empty = 0, PrimaryKey = 1 << 1, Unique = 1 << 2, NotNull = 1 << 3,
  ForeignKey = 1 << 4, AutoIncrement = 1 << 5, ManyToMany = 1 << 6
}
 
enum  OnDelete { DoNothing = 0, Cascade, SetNull }
 
using Type = UT_ORMColumnType
 
- Static Public Member Functions inherited from UT_ORMColumn
static const UT_StringHoldertypeToDisplayName (Type type)
 

Detailed Description

Definition at line 110 of file UT_ORMField.h.

Constructor & Destructor Documentation

UT_ORMFieldColumn::UT_ORMFieldColumn ( const UT_StringHolder name,
UT_UniquePtr< UT_IORMFieldAdapter adapter,
unsigned  props = UT_ORMColumn::Properties::Empty,
UT_ORMColumn::OnDelete  ondelete = UT_ORMColumn::OnDelete::DoNothing,
const UT_StringHolder related_name = UT_StringHolder::theEmptyString 
)
inline

Definition at line 113 of file UT_ORMField.h.

UT_ORMFieldColumn::UT_ORMFieldColumn ( const UT_StringHolder name,
UT_ORMColumn::Type  type,
unsigned  props = UT_ORMColumn::Empty,
UT_ORMColumn::OnDelete  ondelete = UT_ORMColumn::OnDelete::DoNothing 
)
inline

This should almost never be called. Its mainly used with dynamic objects that arent attached to a model but we still want to generate meta information for migrations and migration validation.

Definition at line 126 of file UT_ORMField.h.

Member Function Documentation

UT_IORMFieldAdapter* UT_ORMFieldColumn::adapter ( )
inline

Definition at line 134 of file UT_ORMField.h.

UT_IORMFieldAdapter* UT_ORMFieldColumn::adapter ( ) const
inline

Definition at line 138 of file UT_ORMField.h.

void UT_ORMFieldColumn::connectLinks ( const UT_SharedPtr< UT_ORMModelMeta > &  meta)
UT_SharedPtr<UT_ORMModelMeta> UT_ORMFieldColumn::foreignModel ( ) const
inline

Definition at line 156 of file UT_ORMField.h.

const UT_StringHolder& UT_ORMFieldColumn::m2mFieldName ( ) const
inline

Definition at line 161 of file UT_ORMField.h.

const UT_StringHolder& UT_ORMFieldColumn::m2mReverseFieldName ( ) const
inline

Definition at line 165 of file UT_ORMField.h.

void UT_ORMFieldColumn::setAsManyToMany ( const UT_ORMModelMeta through_meta,
const UT_ORMModelMeta meta,
const UT_StringHolder m2m_field_name,
const UT_ORMModelMeta foreign_meta,
const UT_StringHolder m2m_reverse_field_name,
const UT_StringHolder related_name = UT_StringHolder::theEmptyString 
)
bool UT_ORMFieldColumn::verify ( UT_SqlOrm orm,
UT_Error ec,
UT_StringHolder err_msg 
)

Member Data Documentation

UT_UniquePtr<UT_IORMFieldAdapter> UT_ORMFieldColumn::myFieldPtr
protected

Definition at line 171 of file UT_ORMField.h.

UT_WeakPtr<UT_ORMModelMeta> UT_ORMFieldColumn::myForeignModel
protected

Definition at line 173 of file UT_ORMField.h.

UT_StringHolder UT_ORMFieldColumn::myM2MFieldName
protected

Definition at line 174 of file UT_ORMField.h.

UT_StringHolder UT_ORMFieldColumn::myM2MReverseFieldName
protected

Definition at line 175 of file UT_ORMField.h.

UT_StringHolder UT_ORMFieldColumn::myThroughModelName
protected

Definition at line 172 of file UT_ORMField.h.


The documentation for this class was generated from the following file: