go-on-rails 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +10 -4
- data/lib/generators/gor/go-on-rails/converter.rb +2 -2
- data/lib/generators/gor/gor_generator.rb +2 -2
- data/lib/tasks/gor.rake +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c78bca96908c5b78a11b6fa3d9e2b0d1198543e7
|
4
|
+
data.tar.gz: e4c98605c1395f3d63ce6f8aff4ed234b45845a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 105501fff22de0d0ce7b83514eeff91ecd2f6a20d663c85c572cf23159747237cbb38696d2afd800a388a8c2ea469f0dbb9b4a8b17bae1f90ba309a51c55ff08
|
7
|
+
data.tar.gz: 183e015cdfd48f833fc80fcbd989f404384f2dce9b58aa08d2456569c30ab22efb4fa13f29d1e86b7be49c7bde55f784850dc7da486661adaff84097ad4afa28
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
[](https://badge.fury.io/rb/go-on-rails)
|
2
2
|
[](https://travis-ci.org/goonr/go-on-rails)
|
3
|
+
[](https://gitter.im/goonr/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
3
4
|
|
4
5
|
<img align="right" width="260" height="260" src="./go-on-rails.png">
|
5
6
|
|
@@ -17,7 +18,7 @@ go-on-rails is a Rails generator created for three scenarios:
|
|
17
18
|
Here's some examples:
|
18
19
|
* a simple [example(tutorial)](https://github.com/goonr/example_simple) on the basic usage of go-on-rails generator
|
19
20
|
* [An advanced example](https://github.com/goonr/example_with_admin) shows how to integrate Go APIs in a Rails project
|
20
|
-
* [Another example](https://github.com/goonr/example_read_rails_session) shows how to
|
21
|
+
* [Another example](https://github.com/goonr/example_read_rails_session) shows how to handle a Rails session to get an user's info in a go-on-rails generated Go API
|
21
22
|
|
22
23
|
## Prerequisites
|
23
24
|
|
@@ -93,8 +94,8 @@ And the gem is still under development, so there're a lot of known issues.
|
|
93
94
|
|
94
95
|
## Known issues and TODOs
|
95
96
|
|
96
|
-
* databases specific functions between MySQL
|
97
|
-
* sql.NullType not supported yet, so you'd better in the migrations set those columns "not null" with a default value that's consistent with Golang's zero value specification, such as "" default for string and text typed column, and 0 default for int, etc.
|
97
|
+
* databases specific functions between MySQL and Postgres or other databases are not covered yet
|
98
|
+
* sql.NullType not supported yet, so you'd better in the migrations set those columns "not null" with a default value that's consistent with Golang's zero value specification, such as "" default for string and text typed column, and 0 default for int, etc. And now we have an alternative approch for manipulating the database nullable fields, see the wiki [Working with database nullable fields](https://github.com/goonr/go-on-rails/wiki/Working-with-database-nullable-fields)
|
98
99
|
|
99
100
|
- [x] Associations
|
100
101
|
- [x] has_many
|
@@ -111,10 +112,15 @@ And the gem is still under development, so there're a lot of known issues.
|
|
111
112
|
- [ ] Callbacks
|
112
113
|
- [ ] Transactions
|
113
114
|
|
115
|
+
## Wiki
|
116
|
+
|
117
|
+
* [Built-in Pagination](https://github.com/goonr/go-on-rails/wiki/Pagination)
|
118
|
+
* [Working with database nullable fields](https://github.com/goonr/go-on-rails/wiki/Working-with-database-nullable-fields)
|
119
|
+
|
114
120
|
## Golang dependencies by default
|
115
121
|
|
116
122
|
* [github.com/jmoiron/sqlx](https://github.com/jmoiron/sqlx): an extension on the standard `database/sql` database API library
|
117
|
-
* [github.com/
|
123
|
+
* [github.com/goonr/go-sqlite3](https://github.com/goonr/go-sqlite3): a SQLite driver(This's a forked version of [mattn/go-sqlite3](https://github.com/mattn/go-sqlite3))
|
118
124
|
* [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql): a MySQL driver
|
119
125
|
* [github.com/lib/pq](https://github.com/lib/pq): a PostgreSQL driver
|
120
126
|
* [github.com/asaskevich/govalidator](https://github.com/asaskevich/govalidator): for the struct validation
|
@@ -16,9 +16,9 @@ module GoOnRails
|
|
16
16
|
}.freeze
|
17
17
|
|
18
18
|
# COALESCE datetime typed field for different databases
|
19
|
-
#
|
19
|
+
# sqlite3 is dependent on the driver: https://github.com/goonr/go-sqlite3, details see: https://github.com/mattn/go-sqlite3/pull/468
|
20
20
|
DATETIME_COALESCE_MAP = {
|
21
|
-
"sqlite3" => "%s",
|
21
|
+
"sqlite3" => "CAST(COALESCE(%s, '0001-01-01T00:00:00Z') as text) AS %s",
|
22
22
|
"mysql" => "COALESCE(%s, CONVERT_TZ('0001-01-01 00:00:00','+00:00','UTC')) AS %s",
|
23
23
|
"postgres" => "COALESCE(%s, (TIMESTAMP WITH TIME ZONE '0001-01-01 00:00:00+00') AT TIME ZONE 'UTC') AS %s"
|
24
24
|
}.freeze
|
@@ -86,8 +86,8 @@ class GorGenerator < Rails::Generators::Base
|
|
86
86
|
case db_conf["adapter"]
|
87
87
|
when "sqlite3"
|
88
88
|
@db_config[:driver_name] = "sqlite3"
|
89
|
-
@db_config[:dsn] =
|
90
|
-
@db_config[:driver_package] = "_ \"github.com/
|
89
|
+
@db_config[:dsn] = Rails.root.join(db_conf["database"]).to_s
|
90
|
+
@db_config[:driver_package] = "_ \"github.com/goonr/go-sqlite3\""
|
91
91
|
when "mysql2"
|
92
92
|
@db_config[:driver_name] = "mysql"
|
93
93
|
db_conf["port"] = 3306 unless db_conf["port"]
|
data/lib/tasks/gor.rake
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: go-on-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- B1nj0y
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Modeling, developing and testing your Golang app with your familiar Rails
|
14
14
|
tools like rails generate, db migration, console etc. It is more meant to help integrating
|