Golang에서의 경량 ORM으로서의 bun package를 다루며 경험한 내용을 정리해둔다. Automatic timestamp 링크: https://bun.uptrace.dev/guide/models.html#automatic-timestamps INSERT 시에 생성한 시간을 자동으로 추가하도록 하는 기능이다. Example code with comment 아래 코드와 코멘트로 설명을 마무리 한다. 전체 GitHub Repo: https://github.com/nicewook/bun-orm-study Query Building Example: https://github.com/nicewook/bun-orm-study/blob/main/default-timestamp/main.go bun 태그의 의미..
Golang에서의 경량 ORM으로서의 bun package를 다루며 경험한 내용을 정리해둔다. Query building 링크: https://bun.uptrace.dev/guide/complex-queries.html#query-generation Query를 만들면서 조건에 따라 더욱 이어붙이는 건에 대하여 q = q.Limit() 의 결과가 단순히 q.Limit()와 같은 것을 동료분이 이야기해 알게 되었다. 코드가 더욱 간결해진다. 그런데 위 링크를 보면 심지어 bun 패키지 설명도 그 차이를 모르는 것인가 싶다. Example code with comment 아래 코드와 코멘트로 설명을 마무리 한다. 전체 GitHub Repo: https://github.com/nicewook/bun-orm-s..
Golang에서의 경량 ORM으로서의 bun package를 다루며 경험한 내용을 정리해둔다. ScanAndCount 링크: https://bun.uptrace.dev/guide/query-select.html#count-rows 데이터베이스를 다루며 query 로 리스트를 가져올 때에는 Offset, Limit 를 이용해 그 일부만을 가져와야 할 때가 많다. 그러면서도 paignation 을 위해 전체 개수를 Count 해 주어야 한다. bun 은 ScanAndCount() 기능을 제공한다. 이 매서드가 이쁜 것은 이 지점이다. Offset, Limit가 적용되면서도 Count는 그것이 적용되지 않은 전체 개수를 세어주는 것이다. Example code with comment 아래의 발췌한 코드와 코멘..
- Total
- 386,755
- Today
- 7
- Yesterday
- 307
- powershell
- Gin
- solid
- min heap
- 하드씽
- 명상
- AES
- postgres
- go
- golang
- docker
- heap
- gorilla/websocket
- 자아
- 2022
- 로젠버그
- ORM
- 클린 애자일
- timestamp
- branch
- additional data
- gcm
- 비폭력대화
- Handshake
- bun
- install
- 마셜
- websocket
- 독서후기
- agile