4 Star 5 Fork 4

Plato/Service-Box-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
source.go 617 Bytes
一键复制 编辑 原始数据 按行查看 历史
CloudGuan 提交于 2022-02-27 22:43 . update: add basic config module
package source
import (
"crypto/md5"
"fmt"
"time"
)
// Source is the source from which config is loaded
type Source interface {
Read() (*ChangeSet, error) //read from source, to change set
String() string
}
// ChangeSet represents a set of changes from a source
type ChangeSet struct {
Data []byte //binary data
Checksum string //md5 sum
Format string //format
Source string //name
Timestamp time.Time //time stamp
}
// Sum returns the md5 checksum of the ChangeSet data
func (c *ChangeSet) Sum() string {
h := md5.New()
h.Write(c.Data)
return fmt.Sprintf("%x", h.Sum(nil))
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/dennis-kk/service-box-go.git
git@gitee.com:dennis-kk/service-box-go.git
dennis-kk
service-box-go
Service-Box-go
v0.4.12

搜索帮助

Cb406eda 1850385 E526c682 1850385