This commit is contained in:
Waylon Walker 2023-05-23 08:55:35 -05:00
parent daf81343bf
commit a2b33b25f8
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4
11 changed files with 479 additions and 55 deletions

View file

@ -29,6 +29,8 @@ class FastModel(SQLModel):
with config.database.session as session:
session.add(self)
session.commit()
session.refresh(self)
return
def get(
self, id: int = None, config: "Config" = None, where=None
@ -52,6 +54,16 @@ class FastModel(SQLModel):
results = session.exec(statement).one()
return results
def flags(self, config: "Config" = None) -> None:
if config is None:
config = get_config()
flags = []
for k, v in self.dict().items():
if v:
flags.append(f"--{k.replace('_', '-').lower()}")
flags.append(v)
return flags
# TODO
# update
# delete