Skip to content

Commit

Permalink
golangci-lint: fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
fraenky8 committed Jun 18, 2023
1 parent 3566c9f commit a707289
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 68 deletions.
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
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
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 + `"`
}

0 comments on commit a707289

Please sign in to comment.