Skip to content

Commit

Permalink
Merge pull request #55 from fraenky8/update-go-deps-repo
Browse files Browse the repository at this point in the history
Update and upgrade Go, dependencies, repo
  • Loading branch information
fraenky8 authored Jun 18, 2023
2 parents 848b510 + 9c3c81f commit 7523edb
Show file tree
Hide file tree
Showing 80 changed files with 17,451 additions and 8,304 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ jobs:
name: Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v3
with:
version: latest

Expand All @@ -20,10 +20,10 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 1.18
go-version: '1.20'

- name: Build
run: go build -v -mod=vendor .
Expand Down
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
run:
timeout: 5m
skip-dirs:
- _test

linters:
# We run with all default linters enabled and in addition the linters
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Frank Meyer
Copyright (c) 2023 Frank Meyer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ database schema.

## Requirements

- Go 1.18+
- Go 1.20+

## Install

Expand Down
132 changes: 65 additions & 67 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,87 +4,85 @@
//
// A small and helpful tool which helps during developing with a changing database schema.
//
// Example
// Example.
//
// Assuming you have the following table definition (PostgreSQL):
//
// CREATE TABLE some_user_info (
// id SERIAL NOT NULL PRIMARY KEY,
// first_name VARCHAR(20),
// last_name VARCHAR(20) NOT NULL,
// height DECIMAL
// );
// CREATE TABLE some_user_info (
// id SERIAL NOT NULL PRIMARY KEY,
// first_name VARCHAR(20),
// last_name VARCHAR(20) NOT NULL,
// height DECIMAL
// );
//
// Run the following command (default local PostgreSQL instance):
//
// go run tables-to-go.go
// go run tables-to-go.go
//
// The following file SomeUserInfo.go with default package dto (data transfer object) will be created:
//
// package dto
// package dto
//
// import (
// "database/sql"
// )
// import (
// "database/sql"
// )
//
// type SomeUserInfo struct {
// ID int `db:"id"`
// FirstName sql.NullString `db:"first_name"`
// LastName string `db:"last_name"`
// Height sql.NullFloat64 `db:"height"`
// }
// type SomeUserInfo struct {
// ID int `db:"id"`
// FirstName sql.NullString `db:"first_name"`
// LastName string `db:"last_name"`
// Height sql.NullFloat64 `db:"height"`
// }
//
// Commandline Flags
//
// go run tables-to-go.go -help
// -? shows help and usage
// -d string
// database name (default "postgres")
// -f
// force, skip tables that encounter errors but construct all others
// -format string
// format of struct fields (columns): camelCase (c) or original (o) (default "c")
// -fn-format string
// format of the filename: camelCase (c, default) or snake_case (s)
// -h string
// host of database (default "127.0.0.1")
// -help
// shows help and usage
// -no-initialism
// disable the conversion to upper-case words in column names
// -null string
// representation of NULL columns: sql.Null* (sql) or primitive pointers (native|primitive) (default "sql")
// -of string
// output file path (default "current working directory")
// -p string
// password of user
// -pn string
// package name (default "dto")
// -port string
// port of database host, if not specified, it will be the default ports for the supported databases
// -pre string
// prefix for file- and struct names
// -s string
// schema name (default "public")
// -structable-recorder
// generate a structable.Recorder field
// -suf string
// suffix for file- and struct names
// -t string
// type of database to use, currently supported: [pg mysql] (default "pg")
// -tags-no-db
// do not create db-tags
// -tags-structable
// generate struct with tags for use in Masterminds/structable (https://github.com/Masterminds/structable)
// -tags-structable-only
// generate struct with tags ONLY for use in Masterminds/structable (https://github.com/Masterminds/structable)
// -u string
// user to connect to the database (default "postgres")
// -v verbose output
// -vv
// more verbose output
//
// go run tables-to-go.go -help
// -? shows help and usage
// -d string
// database name (default "postgres")
// -f
// force, skip tables that encounter errors but construct all others
// -format string
// format of struct fields (columns): camelCase (c) or original (o) (default "c")
// -fn-format string
// format of the filename: camelCase (c, default) or snake_case (s)
// -h string
// host of database (default "127.0.0.1")
// -help
// shows help and usage
// -no-initialism
// disable the conversion to upper-case words in column names
// -null string
// representation of NULL columns: sql.Null* (sql) or primitive pointers (native|primitive) (default "sql")
// -of string
// output file path (default "current working directory")
// -p string
// password of user
// -pn string
// package name (default "dto")
// -port string
// port of database host, if not specified, it will be the default ports for the supported databases
// -pre string
// prefix for file- and struct names
// -s string
// schema name (default "public")
// -structable-recorder
// generate a structable.Recorder field
// -suf string
// suffix for file- and struct names
// -t string
// type of database to use, currently supported: [pg mysql] (default "pg")
// -tags-no-db
// do not create db-tags
// -tags-structable
// generate struct with tags for use in Masterminds/structable (https://github.com/Masterminds/structable)
// -tags-structable-only
// generate struct with tags ONLY for use in Masterminds/structable (https://github.com/Masterminds/structable)
// -u string
// user to connect to the database (default "postgres")
// -v verbose output
// -vv
// more verbose output
//
// For more details & examples refer to https://github.com/fraenky8/tables-to-go/blob/master/README.md
//
package main
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
module github.com/fraenky8/tables-to-go

go 1.18
go 1.20

require (
github.com/go-sql-driver/mysql v1.6.0
github.com/go-sql-driver/mysql v1.7.1
github.com/iancoleman/strcase v0.2.0
github.com/jmoiron/sqlx v1.3.5
github.com/lib/pq v1.10.6
github.com/mattn/go-sqlite3 v1.14.14
github.com/stretchr/testify v1.8.0
golang.org/x/text v0.3.7
github.com/lib/pq v1.10.9
github.com/mattn/go-sqlite3 v1.14.17
github.com/stretchr/testify v1.8.4
golang.org/x/text v0.10.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.4.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
21 changes: 12 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0=
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g=
github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.10.6 h1:jbk+ZieJ0D7EVGJYpL9QTz7/YW6UHbmdnZWYyK5cdBs=
github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mattn/go-sqlite3 v1.14.14 h1:qZgc/Rwetq+MtyE18WhzjokPD93dNqLGNT3QJuLvBGw=
github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM=
github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58=
golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
2 changes: 1 addition & 1 deletion pkg/tagger/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import (
type Db struct{}

// GenerateTag for Db to satisfy the Tagger interface.
func (t Db) GenerateTag(db database.Database, column database.Column) string {
func (t Db) GenerateTag(_ database.Database, column database.Column) string {
return `db:"` + column.Name + `"`
}
9 changes: 9 additions & 0 deletions vendor/github.com/go-sql-driver/mysql/AUTHORS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions vendor/github.com/go-sql-driver/mysql/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7523edb

Please sign in to comment.