일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
Tags
- 티스토리챌린지
- 스마트컨트렉트 예약어 함수이름 중복
- ambiguous function description
- 러스트기초
- Vue.js
- 계정추상화
- cloud hsm 사용하기
- 러스트 기초
- Vue
- cloud hsm 서명
- ethers type
- erc4337
- 러스트 기초 학습
- erc4337 contract
- 스마트 컨트렉트 함수이름 중복
- vue기초
- 컨트렉트 동일한 함수이름 호출
- ethers v6
- cloud hsm
- 머신러닝기초
- SBT표준
- 오블완
- redux toolkit 설명
- ethers typescript
- 스마트컨트렉트 함수이름 중복 호출
- rust 기초
- 체인의정석
- redux 기초
- ethers websocket
- git rebase
Archives
- Today
- Total
체인의정석
typescript) typeORM, query Builder, 날짜 검색 구문 쓰기 본문
728x90
type ORM 공식 페이지에서 날짜를 beteween으로 검색하는 부분이 없어서 찾아보았다.
https://github.com/typeorm/typeorm/issues/1221
WHERE, Date, and BETWEEN · Issue #1221 · typeorm/typeorm
It appears that there is a bug with how QueryBuilder is handling dates. I only tested with SQLite, but it is possible that this is happening with other implementations. const start = new Date(date)...
github.com
위의 검색 결과에서 해답을 찾을 수 있었다.
.where('from_Address = :from_address', {
from_address: from_address,
})
.andWhere('item_timestamp >= :from_date', {
from_date: from_date,
})
.andWhere('item_timestamp < :to_date', {
to_date: to_date,
})
다음과 같이 구문을 작성하니, 조건절에서 부등호로 비교를 할 수 있었다.
WHERE from_Address = ? AND item_timestamp >= ? AND item_timestamp < ?
위와 같은 쿼리빌더로 하게되면 아래와 같은 답이 나오게 된다.
728x90
반응형
'개발 > backend(js,ts)' 카테고리의 다른 글
Logger와 logger를 사용해야 하는 이유 (0) | 2021.11.17 |
---|---|
typescript 비동기/동기 처리 (0) | 2021.11.17 |
class validator 사용하기, 다중 validation 처리하기 (1) | 2021.11.09 |
TypeORM & NestJS) Query Selector 사용하여 다수의 데이터를 가져오고 Response 구조로 다수의 데이터 응답 보내기 (0) | 2021.11.03 |
SQL) Paging 처리하기, 페이징 API 만들기 (1) | 2021.11.02 |
Comments