Skip to content

Flexible and powerful Go library for transforming data from various formats (CSV, JSON, etc.) into desired Go struct types. (Insecure)

License

Notifications You must be signed in to change notification settings

Esonhugh/sculptor

Repository files navigation

Sculptor

FlexFormer Logo

Go Report Card License: MIT

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.

Features

  • 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.

Installation

go get github.com/esonhugh/sculptor

Quick Start

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)
	}
}

Demo

demo of merging oneforall.csv and subfinder.json

More Example

Checkout the test folder to see more examples.

Doc

godoc: https://pkg.go.dev/github.com/esonhugh/sculptor

Contributing

welcome contributions! Free for fork and Pull Request.

License

sculptor is licensed under the MIT License. See LICENSE for more details.


Made with ❤️ by Esonhugh

Inspired by AkaAny/gormja_core2

Inspired by Trickest

About

Flexible and powerful Go library for transforming data from various formats (CSV, JSON, etc.) into desired Go struct types. (Insecure)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published