Skip to content

Commit

Permalink
Merge pull request #123 from alexj212/master
Browse files Browse the repository at this point in the history
added new postgres types
  • Loading branch information
alexj212 authored Jul 10, 2020
2 parents 23e8963 + 3d35fac commit 111f65d
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 11 deletions.
8 changes: 5 additions & 3 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _test/dbmeta/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func init() {
goopt.Description = func() string {
return "ORM and RESTful meta data viewer for SQl databases"
}
goopt.Version = "v0.9.22 (07/08/2020)"
goopt.Version = "v0.9.23 (07/10/2020)"
goopt.Summary = `dbmeta [-v] --sqltype=mysql --connstr "user:password@/dbname" --database <databaseName>
sqltype - sql database type such as [ mysql, mssql, postgres, sqlite, etc. ]
Expand Down
4 changes: 2 additions & 2 deletions code_http.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func GetInvoices(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
// @Failure 400 {object} api.HTTPError
// @Failure 404 {object} api.HTTPError
// @Router /invoices [post]
// echo '{"invoice_id": 57,"customer_id": 9,"billing_address": "rMHppATYFwjWxvjTGASkYSPkf","billing_state": "HIwKVtaMVGnQJHqXTJdibIzeA","billing_country": "ZHahDVUYbQzFAbJQkRbRsAPQy","total": 0.4534626433499875,"invoice_date": "2038-10-09T12:04:09.946815184-05:00","billing_city": "zNFsMoKCBYsOawVubnYRDvcmX","billing_postal_code": "BYylGmiCSWSFgfxRsSogPbKxg"}' | http POST "http://127.0.0.1:8080/invoices" X-Api-User:user123
// echo '{"billing_city": "OZXsAdCPKOjTctytoYEwgOtYE","billing_state": "UOfAdBkzjGadsbbjkkhozikYw","billing_postal_code": "GXmsXWLgcCWXRUcuGACWkBVTP","billing_address": "HeOCpxWwhFWfMdiJUZDwKymnA","billing_country": "XiLGkZMtOvVGXsoPVWIIzVCQI","total": 0.10089232722813705,"invoice_id": 97,"customer_id": 7,"invoice_date": "2044-08-15T16:02:07.572705306-05:00"}' | http POST "http://127.0.0.1:8080/invoices" X-Api-User:user123
func AddInvoices(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
ctx := initializeContext(r)
invoices := &model.Invoices{}
Expand Down Expand Up @@ -192,7 +192,7 @@ func AddInvoices(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
// @Failure 400 {object} api.HTTPError
// @Failure 404 {object} api.HTTPError
// @Router /invoices/{argInvoiceID} [patch]
// echo '{"invoice_id": 57,"customer_id": 9,"billing_address": "rMHppATYFwjWxvjTGASkYSPkf","billing_state": "HIwKVtaMVGnQJHqXTJdibIzeA","billing_country": "ZHahDVUYbQzFAbJQkRbRsAPQy","total": 0.4534626433499875,"invoice_date": "2038-10-09T12:04:09.946815184-05:00","billing_city": "zNFsMoKCBYsOawVubnYRDvcmX","billing_postal_code": "BYylGmiCSWSFgfxRsSogPbKxg"}' | http PUT "http://127.0.0.1:8080/invoices/1" X-Api-User:user123
// echo '{"billing_city": "OZXsAdCPKOjTctytoYEwgOtYE","billing_state": "UOfAdBkzjGadsbbjkkhozikYw","billing_postal_code": "GXmsXWLgcCWXRUcuGACWkBVTP","billing_address": "HeOCpxWwhFWfMdiJUZDwKymnA","billing_country": "XiLGkZMtOvVGXsoPVWIIzVCQI","total": 0.10089232722813705,"invoice_id": 97,"customer_id": 7,"invoice_date": "2044-08-15T16:02:07.572705306-05:00"}' | http PUT "http://127.0.0.1:8080/invoices/1" X-Api-User:user123
func UpdateInvoices(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
ctx := initializeContext(r)

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func init() {
goopt.Description = func() string {
return "ORM and RESTful API generator for SQl databases"
}
goopt.Version = "v0.9.22 (07/08/2020)"
goopt.Version = "v0.9.23 (07/10/2020)"
goopt.Summary = `gen [-v] --sqltype=mysql --connstr "user:password@/dbname" --database <databaseName> --module=example.com/example [--json] [--gorm] [--guregu] [--generate-dao] [--generate-proj]
git fetch up
sqltype - sql database type such as [ mysql, mssql, postgres, sqlite, etc. ]
Expand Down
6 changes: 3 additions & 3 deletions packrd/packed-packr.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion readme/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func init() {
goopt.Description = func() string {
return "ORM and RESTful meta data viewer for SQl databases"
}
goopt.Version = "v0.9.22 (07/08/2020)"
goopt.Version = "v0.9.23 (07/10/2020)"
goopt.Summary = `dbmeta [-v] --sqltype=mysql --connstr "user:password@/dbname" --database <databaseName>
sqltype - sql database type such as [ mysql, mssql, postgres, sqlite, etc. ]
Expand Down
2 changes: 2 additions & 0 deletions template/GEN_README.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ Table Name: registration_source
|ms sql |y | y | y | y | y | y| n

## Version History
- v0.9.23 (07/10/2020)
- Added postgres types: bigserial, serial, smallserial, bigserial, float4 to mapping.json
- v0.9.22 (07/08/2020)
- Modified gogo.proto check to use GOPATH not hardcoded.
- Updated gen to error exit on first error encountered
Expand Down
44 changes: 44 additions & 0 deletions template/mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
},
{
"sql_type": "smallint",
"size": 2,
"go_type": "int32",
"json_type": "Integer",
"protobuf_type": "int32",
Expand Down Expand Up @@ -315,6 +316,16 @@
"go_nullable_type": "sql.NullFloat64",
"swagger_type": "float64"
},
{
"sql_type": "float4",
"go_type": "float64",
"json_type": "Float",
"protobuf_type": "float",
"guregu_type": "null.Float",
"go_nullable_type": "sql.NullFloat64",
"swagger_type": "float64"
},

{
"sql_type": "float",
"go_type": "float32",
Expand Down Expand Up @@ -522,6 +533,39 @@
"guregu_type": "null.Float",
"go_nullable_type": "sql.NullFloat64",
"swagger_type": "float32"
},
{
"sql_type": "smallserial",
"size": 2,
"custom": "postgres",
"go_type": "int32",
"json_type": "Integer",
"protobuf_type": "int32",
"guregu_type": "null.Int",
"go_nullable_type": "sql.NullInt64",
"swagger_type": "int"
},
{
"sql_type": "serial",
"size": 4,
"custom": "postgres",
"go_type": "int32",
"json_type": "Integer",
"protobuf_type": "int32",
"guregu_type": "null.Int",
"go_nullable_type": "sql.NullInt64",
"swagger_type": "int"
},
{
"sql_type": "bigserial",
"size": 8,
"custom": "postgres",
"go_type": "int32",
"json_type": "Integer",
"protobuf_type": "int32",
"guregu_type": "null.Int",
"go_nullable_type": "sql.NullInt64",
"swagger_type": "int"
}
]
}

0 comments on commit 111f65d

Please sign in to comment.