当前位置: 首页 > news >正文

html5企业网站开发网络营销成功案例有哪些2022

html5企业网站开发,网络营销成功案例有哪些2022,用户中心网站设计,摄影毕业设计选题作品carbon 是一个轻量级、语义化、对开发者友好的 golang 时间处理库,支持链式调用。 目前已被 awesome-go 收录,如果您觉得不错,请给个 star 吧 github.com/golang-module/carbon gitee.com/golang-module/carbon 安装使用 Golang 版本大于…

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/v2import "github.com/golang-module/carbon/v2"// 使用 gitee 库
go get -u gitee.com/golang-module/carbon/v2import "gitee.com/golang-module/carbon/v2"
Golang 版本小于 1.16
// 使用 github 库
go get -u github.com/golang-module/carbonimport "github.com/golang-module/carbon"// 使用 gitee 库
go get -u gitee.com/golang-module/carbonimport  "gitee.com/golang-module/carbon"
定义模型
type Person struct {Name string `json:"name"`Age  int    `json:"age"`Birthday0 Carbon `json:"birthday0"`Birthday1 Carbon `json:"birthday1" carbon:"date"`Birthday2 Carbon `json:"birthday2" carbon:"time"`Birthday3 Carbon `json:"birthday3" carbon:"dateTime"`Birthday4 Carbon `json:"birthday4" carbon:"date" tz:"PRC"`Birthday5 Carbon `json:"birthday5" carbon:"time" tz:"PRC"`Birthday6 Carbon `json:"birthday6" carbon:"dateTime" tz:"PRC"`
}

type Person struct {Name string `json:"name"`Age  int    `json:"age"`Birthday0 Carbon `json:"birthday0"`Birthday1 Carbon `json:"birthday1" carbon:"layout:2006-01-02"`Birthday2 Carbon `json:"birthday2" carbon:"layout:15:04:05"`Birthday3 Carbon `json:"birthday3" carbon:"layout:2006-01-02 15:04:05"`Birthday4 Carbon `json:"birthday4" carbon:"layout:2006-01-02" tz:"PRC"`Birthday5 Carbon `json:"birthday5" carbon:"layout:15:04:05" tz:"PRC"`Birthday6 Carbon `json:"birthday6" carbon:"layout:2006-01-02 15:04:05" tz:"PRC"`
}

type Person struct {Name string `json:"name"`Age  int    `json:"age"`Birthday0 Carbon `json:"birthday0"`Birthday1 Carbon `json:"birthday1" carbon:"format:Y-m-d"`Birthday2 Carbon `json:"birthday2" carbon:"format:H:i:s"`Birthday3 Carbon `json:"birthday3" carbon:"format:Y-m-d H:i:s"`Birthday4 Carbon `json:"birthday4" carbon:"format:Y-m-d" tz:"PRC"`Birthday5 Carbon `json:"birthday5" carbon:"format:H:i:s" tz:"PRC"`Birthday6 Carbon `json:"birthday6" carbon:"format:Y-m-d H:i:s" tz:"PRC"`
}

如果 carbon 标签没有设置,默认是 layout:2006-01-02 15:04:05;如果 tz 标签没有设置,默认是 Local

实例化模型
now := Parse("2020-08-05 13:14:15", PRC)
person := Person {Name:      "gouguoyin",Age:       18,Birthday0: now,Birthday1: now,Birthday2: now,Birthday3: now,Birthday4: now,Birthday5: now,Birthday6: now,
}
JSON 编码
loadErr := carbon.LoadTag(&person)
if loadErr != nil {// 错误处理log.Fatal(loadErr)
}
data, marshalErr := json.Marshal(person)
if marshalErr != nil {// 错误处理log.Fatal(marshalErr)
}
fmt.Printf("%s", data)
// 输出
{"name": "gouguoyin","age": 18,"birthday0": "2020-08-05 13:14:15","birthday1": "2020-08-05","birthday2": "13:14:15","birthday3": "2020-08-05 13:14:15","birthday4": "2020-08-05","birthday5": "213:14:15","birthday6": "2020-08-05 13:14:15"
}
JSON 解码
str := `{"name": "gouguoyin","age": 18,"birthday0": "2020-08-05 13:14:15","birthday1": "2020-08-05","birthday2": "13:14:15","birthday3": "2020-08-05 13:14:15","birthday4": "2020-08-05","birthday5": "213:14:15","birthday6": "2020-08-05 13:14:15"
}`
var person Person
loadErr := carbon.LoadTag(&person)
if loadErr != nil {// 错误处理log.Fatal(loadErr)
}unmarshalErr := json.Unmarshal([]byte(str), &person)
if unmarshalErr != nil {// 错误处理log.Fatal(unmarshalErr)
}fmt.Sprintf("%s", person.Birthday0) // 2002-08-05 13:14:15
fmt.Sprintf("%s", person.Birthday1) // 2020-08-05
fmt.Sprintf("%s", person.Birthday2) // 13:14:15
fmt.Sprintf("%s", person.Birthday3) // 2002-08-05 13:14:15
fmt.Sprintf("%s", person.Birthday4) // 2002-08-05
fmt.Sprintf("%s", person.Birthday5) // 13:14:15
fmt.Sprintf("%s", person.Birthday6) // 2002-08-05 13:14:15
更新日志
  • 修复在 Now 方法中设置测试时间时 testNow 为 0,造成 IsSetTestNow 方法返回 false 的 bug
  • 添加性能测试文件 xxx_bench_test.go
  • 增加格式模板常量,如 DateTimeFormat, DateFormat, TimeFormat, AtomFormat, ANSICFormat
  • loadTag 函数中 carbon 标签增加对 datetimedatetimeiso8601 等字符串的支持
  • loadTag 函数中新增 tz 标签,用于设置时区
  • ParseByLayout 方法中添加对 UVXZ 格式化符号的支持
  • ToFormatStringFormat 方法中添加对 vux 格式符号的支持
  • ClearTestNow 方法重命名为 UnSetTestNow
  • HasTestNow 方法重命名为 IsSetTestNow
  • xxx_test.go 文件重命名为 xxx_unit_test.go
  • json.go 文件重命名为 encoding.go, json_test.go 文件重命名为 encoding_unit_test.go
  • ClosestFarthest 方法从 traveler.go 文件移动到 extremum.go,从 traveler_test.go 文件移动到 extremum_unit_test.go
  • SetTestNow 方法中接收者类型从 结构体 更改为 指针
http://www.ds6.com.cn/news/70346.html

相关文章:

  • 梅州网站建设重庆seo推广服务
  • 郑州做网站首选九零后网络网域名查询地址
  • wamp网站开发视频教程常用的关键词有哪些
  • 招远专业做网站公司百度一下官网首页
  • 网站需要公安局备案吗黑帽seo365t技术
  • 交通局网站建设方案策划书长春网站制作计划
  • 单位网站等级保护必须做吗whois查询 站长工具
  • wordpress SQL 配置优化官网咨询
  • 长沙网站设如何做平台推广赚钱
  • 中专网站建设与管理就业前景广州百度竞价开户
  • 校园网站建设合同百度文库信息流优化师简历怎么写
  • 做cpa能用什么网站媒体软文发布平台
  • 卧龙区网站建设页面seo公司 彼亿营销
  • 网站建设费用如何入账seo关键词优化
  • 做黄色网站怎么防止被抓网络推广计划书范文
  • 怎么做接口网站线上销售渠道有哪些
  • h5 css3网站欣赏友链对网站seo有帮助吗
  • 什么网站可以做实验室品牌网络营销策划方案
  • wordpress自定义函数独立站seo
  • 网站 关键词库合肥关键词排名工具
  • 网站建设财务计划与预测国外十大免费服务器和域名
  • 互联网相关网站关键词调词平台
  • 河间做网站市场调研的内容
  • 西安有哪些做网站建设的公司百度关键词刷排名教程
  • 怎么减少wordpress网站cpu占用佛山网站优化
  • 湛江网站制作公司百度网站联系方式
  • 在中国怎么做国外网站qq空间刷赞网站推广
  • 赣州网站建设有哪些seo发帖工具
  • 移动公司需要网络工程专业seo优化专员
  • 网站分站是怎么做的谷歌关键词搜索量数据查询