Sculptor is a flexible and powerful Go library for transforming data from various formats (CSV, JSON, etc.) into desired Go struct types.
It is designed to significantly simplify and accelerate the process of data ingestion and formatting.
- Ease of use: Simply define your struct with struct field tag and let sculptor handle the rest.
- Support for multiple data file formats: CSV, JSON, and more.
- Customized your processing: setup fallbackfuncs and customfuncs to handle your data.
- More Options: Set your own delimiter, data parser func and time latency to control the speed of data processing.
- Efficient handling of large data sets: Optimize memory usage and performance.
go get github.com/esonhugh/sculptor
package main
import (
"github.com/esonhugh/sculptor"
"log"
)
type TestStruct struct {
Name string `select:"name"`
Pass string `select:"pass"`
}
func main() {
Doc := sculptor.NewDataSculptor("test.json").
SetDocType(sculptor.JSON_DOCUMENT).
SetQuery("name", "user").
SetQuery("pass", "pass").
SetTargetStruct(&TestStruct{})
Doc.Do() // not block.
go func() {
Doc.Wait() // let process complete and close chan
// Doc.Wg.Wait() // is real Doc.Wait() do.
Doc.Close() // Same as close(Doc.ConstructedOutput)
}()
for i := range Doc.ConstructedOutput {
log.Print(i)
}
}
Checkout the test folder to see more examples.
godoc: https://pkg.go.dev/github.com/esonhugh/sculptor
welcome contributions! Free for fork and Pull Request.
sculptor is licensed under the MIT License. See LICENSE for more details.
Made with ❤️ by Esonhugh
Inspired by AkaAny/gormja_core2
Inspired by Trickest