|
|
@@ -1,3 +1,10 @@ |
|
|
|
# pylint: disable = missing-class-docstring |
|
|
|
# pylint: disable = missing-function-docstring |
|
|
|
|
|
|
|
""" |
|
|
|
みてるぞ式魔改造(言ふほどか?)版 Eloquent |
|
|
|
""" |
|
|
|
|
|
|
|
import eloquent |
|
|
|
|
|
|
|
|
|
|
@@ -6,6 +13,8 @@ class DatabaseManager (eloquent.DatabaseManager): |
|
|
|
|
|
|
|
|
|
|
|
class Model (eloquent.Model): |
|
|
|
id: int |
|
|
|
|
|
|
|
def upsert ( |
|
|
|
self, |
|
|
|
*args: str, |
|
|
@@ -16,5 +25,7 @@ class Model (eloquent.Model): |
|
|
|
row = q.first () |
|
|
|
if row is not None: |
|
|
|
self.id = row.id |
|
|
|
self._Model__exists = True # pylint: disable = protected-access |
|
|
|
# pylint: disable = invalid-name |
|
|
|
# pylint: disable = attribute-defined-outside-init |
|
|
|
self._Model__exists = True |
|
|
|
self.save () |