funcool / funcool/clojure.jdbc
java.time interop
- Ngôn ngữ chính
- Clojure
- Star
- 106
- Fork
- 23
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Would be great to have a file like
```
;; clojure.java-time
(:require
[java-time]
[jdbc.proto :refer [ISQLType ISQLResultSetReadColumn]])
; java.time.LocalDate - java.sql.Date
; java.time.LocalDateTime - java.sql.Timestamp
; java.time.LocalTime - java.sql.Time
(extend-protocol ISQLType
;
java.time.LocalDate
(as-sql-type [this conn]
(java-time/sql-date this))
(set-stmt-parameter! [this conn stmt index]
(.setDate stmt index
(java-time/sql-date this)))
java.time.LocalTime
(as-sql-type [this conn]
(java-time/sql-time this))
(set-stmt-parameter! [this conn stmt index]
(.setTime stmt index
(java-time/sql-time this)))
java.time.LocalDateTime
(as-sql-type [this conn]
(java-time/sql-timestamp this))
(set-stmt-parameter! [this conn stmt index]
(.setTimestamp stmt index
(java-time/sql-timestamp this))))
;
;
(extend-protocol ISQLResultSetReadColumn
;
java.sql.Timestamp
(from-sql-type [this conn metadata index]
(java-time/local-date-time this))
;
java.sql.Date
(from-sql-type [this conn metadata index]
(java-time/local-date this))
;
java.sql.Time
(from-sql-type [this conn metadata index]
(java-time/local-time this)))
;
```
to make `java.time` support easier.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.