Ai
1 Star 0 Fork 0

小义的爸爸/smapping

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
doc.go 1.42 KB
一键复制 编辑 原始数据 按行查看 历史
mashingan 提交于 2020-12-07 05:08 +08:00 . update document example
// Copyright (c) 2018 Rahmatullah
// This library is licensed with MIT license which can be found
// in LICENSE
/*
Package smapping is Library for collecting various operations on struct and its mapping
to interface{} and/or map[string]interface{} type.
Implemented to ease the conversion between Golang struct and json format
together with ease of mapping selections using different part of field tagging.
The implementation is abstraction on top reflection package, reflect.
Examples
The snippet code below will be used accross example for brevity
type source struct {
Label string `json:"label"`
Info string `json:"info"`
Version int `json:"version"`
Toki time.Time `json:"tomare"`
}
type sink struct {
Label string
Info string
}
type differentSink struct {
DiffLabel string `json:"label"`
NiceInfo string `json:"info"`
Version string `json:"unversion"`
Toki time.Time `json:"doki"`
}
type differentSourceSink struct {
Source source `json:"source"`
DiffSink differentSink `json:"differentSink"`
}
var toki = time.Date(2000, time.January, 1, 0, 0, 0, 0, time.UTC)
var sourceobj source = source{
Label: "source",
Info: "the origin",
Version: 1,
Toki: toki,
}
func printIfNotExists(mapped Mapped, keys ...string) {
for _, key := range keys {
if _, ok := mapped[key]; !ok {
fmt.Println(key, ": not exists")
}
}
}
*/
package smapping
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/csharphpython/smapping.git
git@gitee.com:csharphpython/smapping.git
csharphpython
smapping
smapping
master

搜索帮助