carbon 是一個輕量級、語義化、對開發者友好的 golang 時間處理庫,支持鏈式調用。
目前已被 awesome-go 收錄,如果您覺得不錯,請給個 star 吧
github.com/golang-module/carbon
gitee.com/golang-module/carbon
安裝使用
Golang 版本大於等於1.16
// 使用 github 庫
go get -u github.com/golang-module/carbon/v2
import (
"github.com/golang-module/carbon/v2"
)
// 使用 gitee 庫
go get -u gitee.com/golang-module/carbon/v2
import (
"gitee.com/golang-module/carbon/v2")
Golang 版本小於1.16
// 使用 github 庫
go get -u github.com/golang-module/carbon
import (
"github.com/golang-module/carbon"
)
// 使用 gitee 庫
go get -u gitee.com/golang-module/carbon
import (
"gitee.com/golang-module/carbon"
)
更新日誌
- 修復部分方法因併發讀寫造成的線程不安全的 bug
- 修復
DiffInMonths方法輸出錯誤的 bug - 新增
CreateFromStdTime方法,並給FromStdTime,Time2Carbon,Carbon2Time方法添加棄用標識 - 增加對波斯語的支持,由 erfanMomeniii 翻譯
- 將單元測試覆蓋率提升到 100%