🔧 Drizzle ORM 비교 연산자 정리
연산자설명예시 코드
eq | 같다 (Equal) | eq(properties.cityId, 1) → cityId = 1 |
ne | 같지 않다 (Not equal) | ne(properties.status, 'draft') → status != 'draft' |
gt | 보다 크다 (Greater than) | gt(properties.maxGuests, 4) → maxGuests > 4 |
gte | 보다 크거나 같다 (Greater than or equal) | gte(properties.maxGuests, 4) → maxGuests >= 4 |
lt | 보다 작다 (Less than) | lt(properties.price, 100) → price < 100 |
lte | 보다 작거나 같다 (Less than or equal) | lte(properties.price, 100) → price <= 100 |
like | 부분 일치 (대소문자 구분) | like(properties.propertyName, '%아파트%') |
ilike | 부분 일치 (대소문자 구분 없음) | ilike(properties.propertyName, '%아파트%') |
isNull | NULL 여부 확인 | isNull(properties.description) → description IS NULL |
isNotNull | NOT NULL 여부 확인 | isNotNull(properties.description) → description IS NOT NULL |
📌 참고: like vs ilike
- like: '아파트'는 '아파트아파트'에는 일치하지만 '아파트'와 '아파트A'는 구분함 (대소문자 구분 O)
- ilike: 'apartment'와 'Apartment'도 매칭됨 (대소문자 구분 X)