mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 18:03:31 +01:00
schema: Continue
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
9cfcc1bd68
commit
c50c614f13
7 changed files with 223 additions and 52 deletions
|
|
@ -1,19 +1,33 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from typing import Optional, List, Any
|
||||
from typing import Optional, Any
|
||||
|
||||
from .Column import Column
|
||||
from .ColumnSet import ColumnSet
|
||||
|
||||
class SingleForeignKey:
|
||||
|
||||
def __init__(self, child_col, parent_col):
|
||||
def __init__(self, child_col: Column, parent_col: Column):
|
||||
self.__child_col = child_col
|
||||
self.__parent_col = parent_col
|
||||
self.__iterable = (self.__child_col, self.__parent_col)
|
||||
|
||||
def __len__(self):
|
||||
return 2
|
||||
|
||||
def __iter__(self):
|
||||
yield from self.__iterable
|
||||
|
||||
def __repr__(self):
|
||||
return f'{self.__child_col.table.name}.{self.__child_col.name} -> {self.__parent_col.table.name}.{self.__parent_col.name}'
|
||||
|
||||
def __getitem__(self, index):
|
||||
return self.__iterable[index]
|
||||
|
||||
@property
|
||||
def child_col(self):
|
||||
def child_column(self):
|
||||
return self.__child_col
|
||||
|
||||
@property
|
||||
def parent_col(self):
|
||||
def parent_column(self):
|
||||
return self.__parent_col
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue