definitions¶
| authors: | Rémi GATTAZ |
|---|---|
| copyright: | Copyright 2015, IsandlaTech |
| license: | Apache Software License 2.0 |
-
class
restbuilder.models.definitions.ColumnDefinition(aName, aType, aPrimaryKey=False, aForeignKey=None, aNullable=True, aUnique=False, aImmutable=False)¶ Bases:
objectDescription of a Column in a Table
-
isForeignKey()¶ Return a string containg the Table name and the Column name this Column is linked to if the column is a foreign key. None otherwise
Returns: None or a string following the given format : ‘TableName.ColumnName’
-
isImmutable()¶ Return True if the Column can not be modified after it was set. False otherwise :return: boolean
-
isNullable()¶ Return True if the column can be NULL. False otherwise :return: boolean
-
isPrimaryKey()¶ Return True if the column is the columns is part of the primary key. False otherwise :return: bolean
-
isUnique()¶ Return True if the column has a UNIQUE constraint. False otherwise :return: boolean
-
-
class
restbuilder.models.definitions.RelationDefinition(aName, aTarget, aBackRef=None, aOrder=None)¶ Bases:
objectDescription of a relation
-
getBackref()¶ Return the name of the fields to use for the backref
Returns: name of the fields to use for the backref
-
getOrder()¶ Return the name of the column of the target used to sort the elements retrieved with the relation
Returns: name of the column of the target used to sort the elements retrieved with the relation
-
getTarget()¶ Return the relation target
Returns: Target of the relation
-
-
class
restbuilder.models.definitions.TableDefinition(aName)¶ Bases:
objectDescription of a Table in the database
-
addColumn(aColumn)¶ Add a column to the table. Raise an exception if aColumn is not a subclass of ColumnDefinition :param aColumn: Column to add
-
addRelation(aRelation)¶ Add a relation to the table. Raise an exception if aColumn is not a subclass of ColumnDefinition :param aRelation: Relation to add
-