ichorORM.relations
index

Copyright (c) 2018 Timothy Savannah
 
Licensed under the terms of the Lesser GNU Lesser General Public License version 2.1
 
  license can be found at https://raw.githubusercontent.com/kata198/ichorORM/master/LICENSE
 
relations - Defines relation types (One-to-one, one-to-many)

 
Classes
       
builtins.Exception(builtins.BaseException)
RelationIntegrityError
builtins.object
ForeignRelation
OneToManyRelation
OneToOneRelation

 
class ForeignRelation(builtins.object)
    ForeignRelation - Base class of foreign relations
 
  Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class OneToManyRelation(ForeignRelation)
    OneToManyRelation - A relation where one field on the current object references one or more records of another type
 
 
Method resolution order:
OneToManyRelation
ForeignRelation
builtins.object

Methods defined here:
__init__(self, fkFieldName, relatedType, relatedFieldName=None)
__init__ - Create this relation object
 
    @param fkFieldName <str> - The field on the current model that is being referenced
 
    @param relatedType <DatabaseModel type> - The model that references this model on #fkFieldName
 
    @param relatedFieldName <None/str> Default None - The field on the foreign model which references #fkFieldName
 
        If None, referenced the PRIMARY KEY on #relatedType
getRelated(self, sourceObj)
getRelated - Return all related objects based off this relation
 
    @param sourceObj <DatabaseModel instance> - The instance of current object
 
    @return list<DatabaseModel instance> - All instances of foreign model referenced

Data descriptors inherited from ForeignRelation:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class OneToOneRelation(ForeignRelation)
    OneToOneRelation - A foreign relation where a foreign key on one model references one instance of another model
 
 
Method resolution order:
OneToOneRelation
ForeignRelation
builtins.object

Methods defined here:
__init__(self, fkFieldName, relatedType, relatedFieldName=None)
__init__ - Create a OneToOneRelation
 
    @param fkFieldName <str> - The field on the local model which references the foreign model
 
    @param relatedType <DatabaseModel type> - The foreign model type
 
    @param relatedFieldName <None/str> Default None - If None, will use the primary key
        of #relatedType as the other end of the relation. Otherwise, provide an explicit field name.
getRelated(self, sourceObj)
getRelated - Follow the relation on #sourceObj and return the related object
 
    @param sourceObj <DatabaseModel instance> - The instance of the current model
 
    @return <None/DatabaseModel> - None if no related object found, otherwise the related object.

Data descriptors inherited from ForeignRelation:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class RelationIntegrityError(builtins.Exception)
    RelationIntegrityError - Exception raised when there is an integrity violation
    in the relation. For example, if a one-to-one relation returns multiple results.
 
 
Method resolution order:
RelationIntegrityError
builtins.Exception
builtins.BaseException
builtins.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from builtins.Exception:
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

Methods inherited from builtins.BaseException:
__delattr__(self, name, /)
Implement delattr(self, name).
__getattribute__(self, name, /)
Return getattr(self, name).
__reduce__(...)
helper for pickle
__repr__(self, /)
Return repr(self).
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
__setstate__(...)
__str__(self, /)
Return str(self).
with_traceback(...)
Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.

Data descriptors inherited from builtins.BaseException:
__cause__
exception cause
__context__
exception context
__dict__
__suppress_context__
__traceback__
args

 
Functions
       
isForeignRelationType(obj)
isForeignRelationType - Check if passed object extends ForeignRelation
 
    @return <bool> - True if #obj extends ForeignRelation, otherwise False

 
Data
        __all__ = ('ForeignRelation', 'isForeignRelationType', 'RelationIntegrityError', 'OneToOneRelation', 'OneToManyRelation')