-
Notifications
You must be signed in to change notification settings - Fork 2
iterate & isNotNull convert 추가 #1
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: master
Are you sure you want to change the base?
Conversation
1. iterate Convert 기능 구현 2. isNotNull Convert 기능 구현
|
안녕하세요 OldBlackJoe님! 라이브러리를 사용하다가 iterate, isNotNull 기능이 필요하여 구현했습니다. |
| const queryTypes = [ 'statement', 'select', 'insert', 'update', 'delete' ]; | ||
|
|
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.
참조하지 않는 변수 제거
| return convertBinaryCondition(children, param, namespace, iBatisMapper, isFirst); | ||
| break; | ||
| case 'iterate': | ||
| return convertIterate(children, param, namespace, iBatisMapper); |
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.
iterate 기능 추가
| case 'isNotNull': | ||
| return convertBinaryCondition(children, param, namespace, iBatisMapper, isFirst); |
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.
isNotNull 기능 추가
| case 'isNotNull': | ||
| evalResult = param.hasOwnProperty(property); | ||
| break; |
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.
isNotNull의 경우 comapreValue를 갖지 않으므로, Parameter에 속성 Key가 존재하는지만 확인
| var convertString = param[property].reduce((prev, cur, index)=>{ | ||
| var iterateValue = (index === 0) ? `${open}'${cur}'` : `${prev}${conjunction}'${cur}'`; | ||
| if (index === param[property].length - 1) | ||
| iterateValue += close; | ||
| return iterateValue | ||
| }, `${open}${close}`); |
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.
iterate는 open, close, conjuection 옵션을 가짐(ex. open="(", close=")",conjunction=",")
배열로 되어있는 파라미터 값을 해당 옵션을 토대로 변경함.
ex. ["apple", "grape"] → ('apple', 'grape')
Iterate, isNotNull 태그에 대하여 구현했습니다.