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