add selector functionality to generate script
This commit is contained in:
@ -20,7 +20,8 @@ with open(args.schema) as schemaFile:
|
||||
schema = json.load(schemaFile)
|
||||
|
||||
for table in schema["tables"]:
|
||||
for column in table["columns"]:
|
||||
columns = table["columns"]
|
||||
for column in columns:
|
||||
if column["sqltype"] == 'serial':
|
||||
column["apitype"] = 'integer'
|
||||
column["jstype"] = 'number'
|
||||
@ -39,6 +40,7 @@ for table in schema["tables"]:
|
||||
elif column["sqltype"].startswith('numeric'):
|
||||
column["apitype"] = 'number'
|
||||
column["jstype"] = 'number'
|
||||
table["selectors"] = [ y["name"] for y in sorted([ x for x in columns if "selector" in x ], key=lambda x: x["selector"])]
|
||||
|
||||
for f in glob.glob(args.template):
|
||||
print(f"process {f}")
|
||||
|
Reference in New Issue
Block a user