[ NOT NULL, increment, default: `now()`]
(s, loc, tok)
| 65 | |
| 66 | |
| 67 | def parse_column_settings(s, loc, tok): |
| 68 | ''' |
| 69 | [ NOT NULL, increment, default: `now()`] |
| 70 | ''' |
| 71 | result = {} |
| 72 | if tok.get('notnull'): |
| 73 | result['not_null'] = True |
| 74 | if 'pk' in tok: |
| 75 | result['pk'] = True |
| 76 | if 'unique' in tok: |
| 77 | result['unique'] = True |
| 78 | if 'increment' in tok: |
| 79 | result['autoinc'] = True |
| 80 | if 'note' in tok: |
| 81 | result['note'] = tok['note'] |
| 82 | if 'default' in tok: |
| 83 | result['default'] = tok['default'][0] |
| 84 | if 'ref' in tok: |
| 85 | result['ref_blueprints'] = list(tok['ref']) |
| 86 | if 'comment' in tok: |
| 87 | result['comment'] = tok['comment'][0] |
| 88 | if 'property' in tok: |
| 89 | result['properties'] = {k: v for k, v in tok['property']} |
| 90 | return result |
| 91 | |
| 92 | |
| 93 | column_settings.set_parse_action(parse_column_settings) |