null:可从JSON编组为非空的Go的可空Go类型

时间:2021-05-24 18:15:05
【文件属性】:
文件名称:null:可从JSON编组为非空的Go的可空Go类型
文件大小:19KB
文件格式:ZIP
更新时间:2021-05-24 18:15:05
golang json sql marshal nullable 可空转类型 描述 该包为bool,float64,int64,int32,字符串和时间提供了可为空的Go类型。用时间替换sql.NullString,sql.NullInt64,...可以将其封送/从JSON封送。 安装 要安装“ null”,请在您的项目中运行go get: go get github.com/emvi/null 请注意,从1.3开始,“空”需要Go 1.13版或更高版本。 用法 这是演示字符串类型的简短示例。 其他类型(int64,float64和bool)以相同的方式工作。 package main import ( "encoding/json" "database/sql" "fmt" "github.com/emvi/null" ) type NullableString struct { Value null.S
【文件预览】:
null-master
----int64.go(1KB)
----bool.go(1KB)
----time.go(1KB)
----bool_test.go(2KB)
----int32_test.go(2KB)
----int64_test.go(2KB)
----int32.go(1KB)
----.circleci()
--------config.yml(169B)
----time_test.go(2KB)
----float64_test.go(2KB)
----CONTRIBUTING.md(266B)
----LICENSE(1KB)
----doc.go(114B)
----README.md(2KB)
----string_test.go(2KB)
----float64.go(1KB)
----nullgopher.svg(20KB)
----string.go(1KB)

网友评论