{"id":13412797,"url":"https://github.com/artonge/go-csv-tag","last_synced_at":"2025-04-09T08:11:07.030Z","repository":{"id":22004516,"uuid":"94696005","full_name":"artonge/go-csv-tag","owner":"artonge","description":"Read csv file from go using tags","archived":false,"fork":false,"pushed_at":"2024-05-23T08:21:15.000Z","size":65,"stargazers_count":125,"open_issues_count":0,"forks_count":33,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T15:45:08.745Z","etag":null,"topics":["csv","go","hacktoberfest","tags"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/artonge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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},"funding":{"liberapay":"artonge"}},"created_at":"2017-06-18T15:31:16.000Z","updated_at":"2025-03-31T23:57:52.000Z","dependencies_parsed_at":"2022-07-27T02:47:34.701Z","dependency_job_id":"c5f74a5a-cbc7-4bc9-abae-4f01a563a0c8","html_url":"https://github.com/artonge/go-csv-tag","commit_stats":{"total_commits":49,"total_committers":13,"mean_commits":3.769230769230769,"dds":0.7142857142857143,"last_synced_commit":"4b40f225e91a009021bac2ae6fd04a3d90c58b12"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artonge%2Fgo-csv-tag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artonge%2Fgo-csv-tag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artonge%2Fgo-csv-tag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artonge%2Fgo-csv-tag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artonge","download_url":"https://codeload.github.com/artonge/go-csv-tag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247999861,"owners_count":21031046,"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","go","hacktoberfest","tags"],"created_at":"2024-07-30T20:01:29.339Z","updated_at":"2025-04-09T08:11:07.011Z","avatar_url":"https://github.com/artonge.png","language":"Go","funding_links":["https://liberapay.com/artonge"],"categories":["Go","File Handling","文件处理","文件","Files","Relational Databases","\u003cspan id=\"文件-files\"\u003e文件 Files\u003c/span\u003e","文件处理`处理文件和文件系统操作的库`"],"sub_categories":["Search and Analytic Databases","检索及分析资料库","Advanced Console UIs","SQL 查询语句构建库","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e"],"readme":"# go-csv-tag\n\nRead csv file from Go using tags\n\n[![godoc for artonge/go-csv-tag](https://godoc.org/github.com/artonge/go-csv-tag?status.svg)](http://godoc.org/github.com/artonge/go-csv-tag)\n\n![Go](https://github.com/artonge/go-csv-tag/workflows/Go/badge.svg)\n[![goreportcard for artonge/go-csv-tag](https://goreportcard.com/badge/github.com/artonge/go-csv-tag)](https://goreportcard.com/report/artonge/go-csv-tag)\n\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\n\n**The project is in maintenance mode.**\n\nIt is kept compatible with changes in the Go ecosystem but no new features will be developed. PR could be accepted.\n\n# Install\n\n`go get github.com/artonge/go-csv-tag/v2`\n\n# Example\n\n## Load\n\nThe csv file:\n\n```csv\nname, ID, number\nname1, 1, 1.2\nname2, 2, 2.3\nname3, 3, 3.4\n```\n\nYour Go code:\n\n```go\ntype Demo struct {                                // A structure with tags\n\tName string  `csv:\"name\"`\n\tID   int     `csv:\"ID\"`\n\tNum  float64 `csv:\"number\"`\n}\n\ntab := []Demo{}                                   // Create the slice where to put the content\nerr  := csvtag.LoadFromPath(\n\t\"file.csv\",                                   // Path of the csv file\n\t\u0026tab,                                         // A pointer to the create slice\n\tcsvtag.CsvOptions{                            // Load your csv with optional options\n\t\tSeparator: ';',                           // changes the values separator, default to ','\n\t\tHeader: []string{\"name\", \"ID\", \"number\"}, // specify custom headers\n\t\tTagKey: \"csv\",                            // specify a custom tag key, default to 'csv'\n})\n```\n\nYou can also load the data from an io.Reader with:\n\n```go\ncsvtag.LoadFromReader(youReader, \u0026tab)\n```\n\nOr from a string with:\n\n```go\ncsvtag.LoadFromString(yourString, \u0026tab)\n```\n\n## Dump\n\nYour Go code:\n\n```go\ntype Demo struct {                         // A structure with tags\n\tName string  `csv:\"name\"`\n\tID   int     `csv:\"ID\"`\n\tNum  float64 `csv:\"number\"`\n}\n\ntab := []Demo{                             // Create the slice where to put the content\n\tDemo{\n\t\tName: \"some name\",\n\t\tID: 1,\n\t\tNum: 42.5,\n\t},\n}\n\nerr := csvtag.DumpToFile(tab, \"csv_file_name.csv\")\n```\n\nYou can also dump the data into an io.Writer with:\n\n```go\nerr := csvtag.DumpToWriter(tab, yourIOWriter)\n```\n\nOr dump to a string with:\n\n```go\nstr, err := csvtag.DumpToString(tab)\n```\n\nThe csv file written:\n\n```csv\nname,ID,number\nsome name,1,42.5\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartonge%2Fgo-csv-tag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartonge%2Fgo-csv-tag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartonge%2Fgo-csv-tag/lists"}