{"id":27135585,"url":"https://github.com/fanchann/isly","last_synced_at":"2025-08-02T11:10:18.763Z","repository":{"id":286382595,"uuid":"958989581","full_name":"fanchann/isly","owner":"fanchann","description":"Parse CSV easily with support for complex data types.","archived":false,"fork":false,"pushed_at":"2025-04-06T04:46:23.000Z","size":23,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-03T22:47:02.221Z","etag":null,"topics":["csv-parser","golang","golang-library","parser-library"],"latest_commit_sha":null,"homepage":"","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/fanchann.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":"2025-04-02T05:00:50.000Z","updated_at":"2025-04-11T01:30:17.000Z","dependencies_parsed_at":"2025-04-06T05:34:18.380Z","dependency_job_id":null,"html_url":"https://github.com/fanchann/isly","commit_stats":null,"previous_names":["fanchann/isly"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/fanchann/isly","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fanchann%2Fisly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fanchann%2Fisly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fanchann%2Fisly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fanchann%2Fisly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fanchann","download_url":"https://codeload.github.com/fanchann/isly/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fanchann%2Fisly/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268378812,"owners_count":24240896,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-parser","golang","golang-library","parser-library"],"created_at":"2025-04-08T01:48:47.136Z","updated_at":"2025-08-02T11:10:18.735Z","avatar_url":"https://github.com/fanchann.png","language":"Go","readme":"# isly\n\n**isly** is a Go library that allows you to parse CSV files into structs with support for various data types like dates, lists, JSON, hex, and binary — all configured via struct tags.\n\n---\n\n## Installation\n\n```bash\ngo get github.com/fanchann/isly\n```\n\n---\n\n## Features\n\n- Automatic parsing from CSV to Go structs  \n- Flexible time format parsing (`time.Time`)  \n- JSON parsing from CSV columns  \n- List/slice parsing (string/int/float)  \n- Support for hex and binary formats  \n- Tag-based configuration for simple and powerful control  \n\n---\n\n## Basic Usage\n\n### CSV File Example\nor see [example](https://github.com/fanchann/isly/blob/master/_examples/main.go)\n- **`data.csv`**\n```csv\nid,name,age,salary,is_active,scores,tags,metadata,created_at,null_value,special_chars,hex_value,binary_data\n1,John Doe,29,50000.75,true,\"[90, 85, 88]\",\"['dev', 'admin']\",\"{'role': 'manager', 'level': 5}\",2023-07-15,,@#$%^\u0026*,0x1A3F,\"b'010101'\"\n2,Jane Smith,34,60000.50,false,\"[78, 92, 87]\",\"['hr', 'finance']\",\"{'role': 'hr', 'level': 4}\",2022-05-10,,∑πΩ≈,0xDEADBEEF,\"b'111000'\"\n```\n\n### 1. Define Your Struct with `isly` Tags\n\n```go\ntype ExampleStruct struct {\n\tID           int                    `isly:\"id\"`\n\tName         string                 `isly:\"name\"`\n\tAge          int                    `isly:\"age\"`\n\tSalary       float64                `isly:\"salary\"`\n\tIsActive     bool                   `isly:\"is_active\"`\n\tScores       []int                  `isly:\"scores, list\"`\n\tTags         []string               `isly:\"tags, list\"`\n\tMetadata     map[string]interface{} `isly:\"metadata, json\"`\n\tCreatedAt    time.Time              `isly:\"created_at, 2006-01-02\"`\n\tNullValue    string                 `isly:\"null_value\"`\n\tSpecialChars string                 `isly:\"special_chars\"`\n\tHexValue     []byte                 `isly:\"hex_value, hex\"`\n\tBinaryData   []byte                 `isly:\"binary_data, binary\"`\n}\n```\n\n### 2. Read and Parse the CSV File\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"github.com/fanchann/isly\"\n)\n\nfunc main() {\n\tvar list []ExampleStruct\n\tislyComp := isly.NewIsly()\n\n\tislyComp.ReadFile(\"data.csv\")\n\tif err := islyComp.UnmarshalCSV(\u0026list); err != nil {\n\t\tfmt.Println(\"Error:\", err)\n\t\treturn\n\t}\n\n\tfor _, e := range list {\n\t\tfmt.Println(\"------------\")\n\t\tfmt.Printf(\"ID: %d | Name: %s | Age: %d | Salary: %.2f | Active: %v\\n\",\n\t\t\te.ID, e.Name, e.Age, e.Salary, e.IsActive)\n\t\tfmt.Printf(\"Scores: %v | Tags: %v\\n\", e.Scores, e.Tags)\n\t\tfmt.Printf(\"Metadata: %v\\n\", e.Metadata)\n\t\tfmt.Printf(\"CreatedAt: %s\\n\", e.CreatedAt)\n\t\tfmt.Printf(\"NullValue: %q | SpecialChars: %q\\n\", e.NullValue, e.SpecialChars)\n\t\tfmt.Printf(\"HexValue: %v\\n\", e.HexValue)\n\t\tfmt.Printf(\"BinaryData: %s\\n\", formatBinary(e.BinaryData))\n\t}\n}\n```\n \n```sh\n# output\n------------\nID: 1 | Name: John Doe | Age: 29 | Salary: 50000.75 | Active: true\nScores: [90 85 88] | Tags: [dev admin]\nMetadata: map[level:5 role:manager]\nCreatedAt: 2023-07-15 00:00:00 +0000 UTC\nNullValue: \"\" | SpecialChars: \"@#$%^\u0026*\"\nHexValue: [26 63]\nBinaryData: 00010101\n------------\nID: 2 | Name: Jane Smith | Age: 34 | Salary: 60000.50 | Active: false\nScores: [78 92 87] | Tags: [hr finance]\nMetadata: map[level:4 role:hr]\nCreatedAt: 2022-05-10 00:00:00 +0000 UTC\nNullValue: \"\" | SpecialChars: \"∑πΩ≈\"\nHexValue: [222 173 190 239]\nBinaryData: 00111000\n```\n\n---\n\n## Supported Tag Formats\n\n| Tag Format                        | Description                                  |\n|----------------------------------|----------------------------------------------|\n| `isly:\"field\"`                   | Maps a regular CSV column                    |\n| `isly:\"field, list\"`             | Parses into a slice (`[]string`, `[]int`, etc.) |\n| `isly:\"field, json\"`             | Parses into a map (`map[string]interface{}`) |\n| `isly:\"field, 2006-01-02\"`       | Parses into `time.Time` with the given format |\n| `isly:\"field, hex\"`              | Decodes hex strings into `[]byte`            |\n| `isly:\"field, binary\"`           | Decodes binary strings into `[]byte`         |\n\n---\n\n## Isly Benchmark\n\n```sh\n# CPU: 12th Gen Intel i3-1215U (8) @ 4.400GHz\n# need improvement in memory allocs\n\nBenchmarkReadFile-8                               111432              9444 ns/op             136 B/op          3 allocs/op\nBenchmarkUnmarshalCSVSingleStruct-8                11934            106971 ns/op           11334 B/op         99 allocs/op\nBenchmarkUnmarshalCSVMultipleStructs-8               279           3981534 ns/op          642708 B/op       8328 allocs/op\nBenchmarkWithDifferentSizes/Size-10-8               2136            537560 ns/op           68881 B/op        854 allocs/op\nBenchmarkWithDifferentSizes/Size-100-8               297           4557274 ns/op          643481 B/op       8328 allocs/op\nBenchmarkWithDifferentSizes/Size-1000-8               25          41513950 ns/op         6392851 B/op      83055 allocs/op\nBenchmarkWithDifferentSizes/Size-10000-8               2         527329355 ns/op        63998328 B/op     830194 allocs/op\n```\n\n## License\n\n```LICENSE\nThe MIT License (MIT)\nCopyright (c) 2025 Fanchann\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffanchann%2Fisly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffanchann%2Fisly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffanchann%2Fisly/lists"}