initial commit
This commit is contained in:
37
README.md
Normal file
37
README.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# json-dataloader-golang
|
||||||
|
|
||||||
|
## usage
|
||||||
|
|
||||||
|
```shell
|
||||||
|
go get gitea.v39.writerpass.top/Public/json-configure-golang
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gitea.v39.writerpass.top/Public/json-dataloader-golang/core"
|
||||||
|
"gitea.v39.writerpass.top/Public/json-dataloader-golang/utils"
|
||||||
|
)
|
||||||
|
|
||||||
|
type SampleData struct {
|
||||||
|
Data string `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (receiver *SampleData) Default() {
|
||||||
|
receiver.Data = "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
data := SampleData{}
|
||||||
|
|
||||||
|
dataClipBuilder := core.DataClipBuilder{}
|
||||||
|
dataClipBuilder.InFile("config.json")
|
||||||
|
dataClipBuilder.RegisterType(data)
|
||||||
|
|
||||||
|
dataClip := dataClipBuilder.Build()
|
||||||
|
data = dataClip.Setup(data).(SampleData)
|
||||||
|
|
||||||
|
utils.PrintStruct(data, "", false)
|
||||||
|
}
|
||||||
|
```
|
Reference in New Issue
Block a user