Easy to use library and CLI utility to generate Go struct from CSV files.

csv2struct

Easy to use library and CLI utility to generate Go struct from CSV files. As a benefit, it's fully compatible with csvutil. So, structs generated by this utility can be used with that library.

Install

go get -u github.com/Koshqua/csv2struct

Usage

NAME:
   csv2struct - Converts csv files to golang structs compatible with https://github.com/jszwec/csvutil

USAGE:
   csv2struct [global options] command [command options] [arguments...]

AUTHOR:
   Ivan Malovanyi (https://github.com/Koshqua)

COMMANDS:
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --from value, -f value        specify which csv file to use
   --to value, -t value          specify the output .go file
   --typename value, --tn value  specify how to name output type
   --csvsep value, --cs value    specify the csv separator (default: ",")
   --casetype value, --ct value  specify the headers case type, possible values are: pascal, camel, kebab, snake, space (default: "pascal")
   --verbose, -v                 verbose logging (with debug) (default: false)
   --help, -h                    show help (default: false)

Example

csv2struct -f ./test.csv -t ./blah.go -tn Blah --casetype space  

Also, it's available as library. Will provide usage examples a bit later...

Contribution

Your contribution to the project is welcomed and appreciated.

Owner
Ivan Maliovaniy
Software Engineer. Working mostly with Go.
Ivan Maliovaniy
Similar Resources

Simple, lightweight, and easy to use gopacket wrapper cli

gniffer Simple, lightweight, and easy to use gopacket wrapper cli Explore the docs » View Demo · Report Bug · Request Feature Table of Contents About

Dec 25, 2021

A simple script to run speedtest(offical) CLI tool and store the results in CSV

PeriodicBW A script made to run official speedtest.net binary periodically and store the results in a CSV file Installation Get the official speedtest

Aug 10, 2021

An easy to use menu structure for cli applications that prompts users to make choices.

An easy to use menu structure for cli applications that prompts users to make choices.

WMenu Package wmenu creates menus for cli programs. It uses wlog for its interface with the command line. It uses os.Stdin, os.Stdout, and os.Stderr w

Dec 26, 2022

An easy-to-use cli tool for downloading manga

An easy-to-use cli tool for downloading manga

mangodl Download and search manga right from the terminal! Report Bug || Request Feature Table of Contents About the Project Built With Getting Starte

Nov 26, 2022

Easy to use CLI for cryptography

EDH (Encryption, Decryption, Hashing) Utility that aims to improve efficiency of encryption, decryption and hashing by making a simple to use CLI Writ

Nov 4, 2021

CLI tool to rank proposals according to Majority Judgment, from an input CSV

CLI tool to rank proposals according to Majority Judgment, from an input CSV

Majority Judgment CLI tool WORK IN PROGRESS Although the core mechanics are here and ranking does work, the features described in this README are not

Sep 10, 2022

CLI filters the contents of the csv file according to the filters from the another file.

filtercsv CLI filters the contents of the csv file according to the filters from the another file. Made to process big files by a lots of filters. By

Dec 2, 2021

Rem is a CLI trash which makes it ridiculously easy to recover files.

Rem is a CLI trash which makes it ridiculously easy to recover files.

Rem is a CLI trash which makes it ridiculously easy to recover files. We've all had that moment when we've deleted something we realised we shouldn't have. It sucks. Let's fix that!

Dec 21, 2022

Go library and CLI utility for /etc/hosts management.

Go library and CLI utility for /etc/hosts management.

Etc Hosts Management Utility & Go Library /etc/hosts Management It is easy to open your /etc/hosts file in text editor and add or remove entries. Howe

Nov 27, 2022
Comments
  • bump go version

    bump go version

    On branch bump-version

    Changes to be committed:

    (use "git restore --staged ..." to unstage)

    modified: go.mod

    modified: go.sum

    modified: main.go

  • Can't install csv2struct

    Can't install csv2struct

    If I git clone the repo and run go install it works but the following does not work

    go install github.com/Koshqua/csv2struct@latest
    go: github.com/Koshqua/csv2struct@latest: github.com/Koshqua/[email protected]: parsing go.mod:
    	module declares its path as: github.com/koshqua/csv2struct
    	        but was required as: github.com/Koshqua/csv2struct
    

    Looks like a typo in your go.mod file.

Go generator to copy values from type to type and fields from struct to struct. Copier without reflection.

Copygen is a command-line code generator that generates type-to-type and field-to-field struct code without adding any reflection or dependenc

Dec 29, 2022
Go-file-downloader-ftctl - A file downloader cli built using golang. Makes use of cobra for building the cli and go concurrent feature to download files.

ftctl This is a file downloader cli written in Golang which uses the concurrent feature of go to download files. The cli is built using cobra. How to

Jan 2, 2022
Command-line tool to load csv and excel (xlsx) files and run sql commands
Command-line tool to load csv and excel (xlsx) files and run sql commands

csv-sql supports loading and saving results as CSV and XLSX files with data processing with SQLite compatible sql commands including joins.

Nov 2, 2022
Simple and easy to use command line application written in Go for cleaning unnecessary XCode files.

xcclear Say hello to a few extra gigabytes of space on your Mac with xcclear, a simple and easy to use command line application written in Go for clea

Dec 16, 2022
A tool to manage all your boilerplate from cli and generate files for you !

A tool to manage all your boilerplate from cli and generate files for you !

Jul 20, 2022
A GitHub CLI extension to view and generate license files.

gh-license A GitHub CLI extension to view and generate license files. All license information is obtained from the GitHub API. NOTE: The only purpose

Oct 8, 2022
Automatically generate Go (golang) struct definitions from example JSON

gojson gojson generates go struct definitions from json or yaml documents. Example $ curl -s https://api.github.com/repos/chimeracoder/gojson | gojson

Jan 1, 2023
A fast diff tool for comparing csv files

csvdiff A fast diff tool for comparing csv files. What is csvdiff? Csvdiff is a difftool to compute changes between two csv files. It is not a traditi

Dec 28, 2022
A piece of software that shouldn't need to exist. Processes badly formatted outputs from Morgan Stanley Shareworks into usable CSV files.
A piece of software that shouldn't need to exist.  Processes badly formatted outputs from Morgan Stanley Shareworks into usable CSV files.

Shareworks-munger: A program to process Shareworks reports into Something Usable "Shareworks" is a product of Morgan Stanley which tracks certain kind

Jun 6, 2022