test em
This commit is contained in:
parent
daf81343bf
commit
a2b33b25f8
11 changed files with 479 additions and 55 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue