https://github.com/ndlinh/t2t
MySQL tables to golang structs
https://github.com/ndlinh/t2t
generated-code golang
Last synced: 9 months ago
JSON representation
MySQL tables to golang structs
- Host: GitHub
- URL: https://github.com/ndlinh/t2t
- Owner: ndlinh
- License: mit
- Created: 2018-07-19T04:45:53.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-07-19T05:48:12.000Z (over 7 years ago)
- Last Synced: 2025-01-29T08:26:30.371Z (11 months ago)
- Topics: generated-code, golang
- Language: Go
- Size: 6.84 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Introduction
This package provide helper functions for generate go struct from MySQL table.
Generated structs that can be use with https://github.com/jmoiron/sqlx/ package.
# How to use
## Installation
go get github.com/jmoiron/sqlx
go get -u github.com/ndlinh/t2t
# Usage
t2t -dsn -p [-o output directory] [-t tables]
Options:
-dsn string
DB connect DSN. Ex: root:root@localhost/flarum
-o string
Optional. Output directory. Use current directory if empty
-p string
Package name
-t string
Optional. Tables to export. Use commas to separate table's name
Ex: t2t -p "test" -o "./test" -t "users_tags" -dsn "root:root@localhost/flarum_test"
# Todos
- [ ] Writing tests
- [ ] PostgreSQL dialect