{"id":15050601,"url":"https://github.com/jimsmart/peanut","last_synced_at":"2025-07-06T05:40:07.316Z","repository":{"id":57577133,"uuid":"357716586","full_name":"jimsmart/peanut","owner":"jimsmart","description":"peanut is a Go package to write tagged data structs to disk in a variety of formats, simply and without ceremony.","archived":false,"fork":false,"pushed_at":"2023-01-18T21:23:12.000Z","size":116,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-10T02:14:49.045Z","etag":null,"topics":["csv","excel","go","jsonl","log-file","sqlite","struct-writer","tsv"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jimsmart.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-13T23:36:28.000Z","updated_at":"2023-11-10T18:04:29.000Z","dependencies_parsed_at":"2023-01-29T15:45:42.693Z","dependency_job_id":null,"html_url":"https://github.com/jimsmart/peanut","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimsmart%2Fpeanut","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimsmart%2Fpeanut/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimsmart%2Fpeanut/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimsmart%2Fpeanut/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jimsmart","download_url":"https://codeload.github.com/jimsmart/peanut/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248142902,"owners_count":21054671,"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":["csv","excel","go","jsonl","log-file","sqlite","struct-writer","tsv"],"created_at":"2024-09-24T21:27:45.021Z","updated_at":"2025-04-10T02:14:56.691Z","avatar_url":"https://github.com/jimsmart.png","language":"Go","readme":"# peanut\n\n[![BSD3](https://img.shields.io/badge/license-BSD3-blue.svg)](LICENSE.md)\n[![Build Status](https://github.com/jimsmart/peanut/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/jimsmart/peanut/actions/workflows/main.yml)\n[![codecov](https://codecov.io/gh/jimsmart/peanut/branch/master/graph/badge.svg)](https://codecov.io/gh/jimsmart/peanut)\n[![Go Report Card](https://goreportcard.com/badge/github.com/jimsmart/peanut?cache-buster)](https://goreportcard.com/report/github.com/jimsmart/peanut)\n[![Used By](https://img.shields.io/sourcegraph/rrc/github.com/jimsmart/peanut.svg)](https://sourcegraph.com/github.com/jimsmart/peanut)\n[![Godoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/jimsmart/peanut)\n\npeanut is a [Go](https://golang.org/) package to write tagged data structs to disk in a variety of formats.\n\nIts primary purpose is to provide a single consistent interface\nfor easy, ceremony-free persistence of record-based struct data.\n\nEach distinct struct type is written to an individual file (or table),\nautomatically created, each named according to the name of the struct.\nField/column names in each file/table are derived from struct tags.\nAll writers use the same tags.\n\nCurrently supported formats are CSV, TSV, Excel (.xlsx), JSON Lines (JSONL), and SQLite.\nAdditional writers are also provided to assist with testing and debugging.\nMutiple writers can be combined using MultiWriter.\n\nAll writers perform atomic file operations, writing data to a temporary location and moving\nit to the final output location when Close is called.\n\n## About\n\nWhen building an app or tool that needs to output data consisting of\nmultiple different record types to disk, perhaps with requirements that\nchange over time (whether during development or after initial deployment),\nperhaps requiring multiple output formats (during development/testing,\nor as final output) — is where peanut might be 'the right tool for the job'.\n\nIdeal for use as an output solution for, e.g. data conversion tools,\npart of an ETL pipeline, data-acquistion or extraction tools/apps, web-scrapers,\nstructured logging, persistence of captured data/metadata/events,\njob reporting, etc.\nWhether building an ad-hoc tool as a quick hack, or as part of a bigger,\nmore serious project.\n\npeanut initially evolved as part of a larger closed-source project,\nis tried and tested, and production-ready.\n\n## Quickstart\n\n### Installation\n\nGet the package:\n\n```bash\ngo get github.com/jimsmart/peanut\n```\n\nUse the package within your code:\n\n```go\nimport \"github.com/jimsmart/peanut\"\n```\n\n### API\n\nAll peanut writers implement this interface:\n\n```go\ntype Writer interface {\n    Write(r interface{}) error\n    Close() error\n    Cancel() error\n}\n```\n\n### Usage\n\n1. Tag some structs.\n2. Initialise a `peanut.Writer` to use.\n3. Collect and assign data into tagged structs.\n4. Call `Write()` to write records, repeating until done.\n5. Call `Close()` to finish.\n\n### Example Code\n\nSee GoDocs.\n\n## Documentation\n\nGoDocs [https://godoc.org/github.com/jimsmart/peanut](https://godoc.org/github.com/jimsmart/peanut)\n\n## Testing\n\nTo run the tests execute `go test` inside the project folder.\n\nFor a full coverage report, try:\n\n```bash\ngo test -coverprofile=coverage.out \u0026\u0026 go tool cover -html=coverage.out\n```\n\n## License\n\nPackage peanut is copyright 2020-2023 by Jim Smart and released under the [BSD 3-Clause License](LICENSE.md).\n\n## History\n\n- v1.0.5 (2022-01-18) Updated dependencies.\n- v1.0.4 (2022-12-16) Updated dependencies.\n- v1.0.3 (2021-04-19) Relax semantics of Close/Cancel. Improved error handling.\n- v1.0.2 (2021-04-19) Fixup handling of uints.\n- v1.0.1 (2021-04-19) Repository made public.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimsmart%2Fpeanut","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjimsmart%2Fpeanut","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimsmart%2Fpeanut/lists"}