{"id":26751636,"url":"https://github.com/michaelwp/gocsv","last_synced_at":"2025-10-15T07:04:32.791Z","repository":{"id":248405592,"uuid":"828595394","full_name":"michaelwp/goCsv","owner":"michaelwp","description":"The go-csv package provides an easy-to-use interface for generating CSV files with concurrent processing","archived":false,"fork":false,"pushed_at":"2025-03-27T15:48:53.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T15:49:57.196Z","etag":null,"topics":["concurrency","csv","go","golang","stream"],"latest_commit_sha":null,"homepage":"https://goblog.dev/articles/39","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelwp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-14T16:08:50.000Z","updated_at":"2025-03-27T15:39:16.000Z","dependencies_parsed_at":"2024-07-14T18:02:42.018Z","dependency_job_id":"f7bf6cf4-a5ad-44e6-b7d6-919e9c422697","html_url":"https://github.com/michaelwp/goCsv","commit_stats":null,"previous_names":["michaelwp/go-csv","michaelwp/gocsv"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2FgoCsv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2FgoCsv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2FgoCsv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2FgoCsv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelwp","download_url":"https://codeload.github.com/michaelwp/goCsv/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246028443,"owners_count":20712016,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["concurrency","csv","go","golang","stream"],"created_at":"2025-03-28T12:26:14.477Z","updated_at":"2025-10-15T07:04:27.740Z","avatar_url":"https://github.com/michaelwp.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# goCsv\n\nThe `goCsv` package provides an easy-to-use interface for generating CSV files with concurrent processing. This package is particularly useful for handling large datasets and performing stream processing.\n\n## Installation\n\nTo install the package, use `go get`:\n\n```bash\ngo get github.com/michaelwp/goCsv/v2\n```\n\n## Usage\n\n### Generate Function\n\nThe `Generate` function creates a CSV file with the given headers and data.\n\n#### Example:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strconv\"\n\t\"time\"\n\n\tgocsv \"github.com/michaelwp/goCsv/v2\"\n)\n\nfunc main() {\n\twindowSize := int64(100)\n\tfilePath := \"output\"\n\theaders := []string{\"No\", \"First Name\", \"Last Name\", \"Gender\", \"Age\", \"Occupation\", \"Address\", \"Remark\"}\n\trowNumbers := 100000000\n\tdata := GenerateSampleData(rowNumbers)\n\tsecond := 1 * time.Second\n\n\tctx, cancel := context.WithTimeout(context.Background(), second)\n\tdefer cancel()\n\n\terr := gocsv.Generate(ctx, \u0026gocsv.Request{\n\t\tWindowSize: windowSize,\n\t\tFilePath:   filePath,\n\t\tHeaders:    headers,\n\t\tData:       data,\n\t})\n\tif err != nil {\n\t\tlog.Println(\"failed to create csv\", err)\n\t\treturn\n\t}\n\n\tlog.Printf(\"successfully in generating %s.csv with %d data less than %v\",\n\t\tfilePath, rowNumbers, second)\n}\n\nfunc GenerateSampleData(rowNumber int) [][]string {\n\tvar data = make([][]string, rowNumber)\n\n\tfor i := 0; i \u003c rowNumber; i++ {\n\t\tnoStr := strconv.Itoa(i + 1)\n\t\tdata[i] = []string{\n\t\t\tnoStr,\n\t\t\t\"John\",\n\t\t\t\"Smith\",\n\t\t\t\"Male\",\n\t\t\t\"30\",\n\t\t\t\"Engineer\",\n\t\t\t\"South Tangerang, Banten, Indonesia\",\n\t\t\t\"Has over than 15 years of work experience\",\n\t\t}\n\t}\n\n\treturn data\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelwp%2Fgocsv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelwp%2Fgocsv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelwp%2Fgocsv/lists"}