MCPcopy Index your code
hub / github.com/dataease/SQLBot / list_all

Function list_all

backend/apps/system/crud/system_variable.py:38–53  ·  view source on GitHub ↗
(session: SessionDep, trans: Trans, variable: SystemVariable)

Source from the content-addressed store, hash-verified

36
37
38def list_all(session: SessionDep, trans: Trans, variable: SystemVariable):
39 if variable.name is None:
40 records = session.query(SystemVariable).order_by(SystemVariable.type.desc(),
41 SystemVariable.name.asc()).all()
42 else:
43 records = session.query(SystemVariable).filter(
44 and_(SystemVariable.name.ilike(f'%{variable.name}%'), SystemVariable.type != 'system')).order_by(
45 SystemVariable.type.desc(), SystemVariable.name.asc()).all()
46
47 res = []
48 for r in records:
49 data = SystemVariable(**r.__dict__)
50 if data.type == 'system':
51 data.name = trans(data.name)
52 res.append(data)
53 return res
54
55
56async def list_page(session: SessionDep, trans: Trans, pageNum: int, pageSize: int, variable: SystemVariable):

Callers 1

list_all_dataFunction · 0.90

Calls 3

SystemVariableClass · 0.90
filterMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected