-
Notifications
You must be signed in to change notification settings - Fork 2
[feat] a new syntatx of default value #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
BernieHuang2008
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approve some changes, some pending.
BernieHuang2008
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good
| default_value = None | ||
|
|
||
|
|
||
| # 支持 type_ 为 [str, "默认值"] 的写法 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest that to use tuple instead of list, since there's already a usage:
tb['col_name'] = str, "hello"The code is as below
https://github.com/BernieHuang2008/MercurySQL/blob/ffc6e463bec44a94546b2438ab5c5474a5698d4b/MercurySQL/gensql/table.py#L148C1-L152C29
Python will parse the situation above as tuple, so it's recommend to have the same form as the one already implemented in table.__setitem__().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lanbinleo 这块最好还是你来改一下吧,我不知道你在哪调用了这玩意
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| if name in self.columns: | ||
| if type_.lower() != self.columnsType[name].lower(): | ||
| if rebuild: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently deciding whether i will use this ...
| return str(data).lower() | ||
| elif isinstance(data, (int, float)): | ||
| return str(data) | ||
| elif isinstance(data, bytes): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
waiting to be tested
|
@lanbinleo 这次改的有点多,我要先理解一下 (>_<) |

No description provided.