go-on-rails 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25289bcbadbef0dfd3ea8b2a40485cdb1c2c8862
|
4
|
+
data.tar.gz: af6b2200a33c29ed1e3393a5b74858ee737b10a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 525c1d5c73e45658c9038051ef7fc00fcd223f59371f8b44fe19f196600c18ddff0bb39a6ad1e03e833830c6fba172a176e7409c8885b95fbac0b1001e55b239
|
7
|
+
data.tar.gz: 275f4e5c119a7e4d3ee0bd4b2506d66f879520c1908de193205e71b09b6b68d196e3cc5f7605f98841af89cbefb435e52560853a1c204938489420d8300929b4
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
[![Gem Version](https://badge.fury.io/rb/go-on-rails.svg)](https://badge.fury.io/rb/go-on-rails)
|
2
|
+
[![Build Status](https://travis-ci.org/goonr/go-on-rails.svg?branch=dev)](https://travis-ci.org/goonr/go-on-rails)
|
2
3
|
|
3
4
|
<img align="right" width="260" height="260" src="./go-on-rails.png">
|
4
5
|
|
@@ -18,14 +19,14 @@ Here's a simple [example(tutorial)](https://github.com/goonr/example_simple) sho
|
|
18
19
|
## Prerequisites
|
19
20
|
|
20
21
|
* Rails 4.2+
|
21
|
-
* Golang 1.
|
22
|
+
* Golang 1.5.x
|
22
23
|
|
23
24
|
## Installation
|
24
25
|
|
25
26
|
Add this line to your application's Gemfile:
|
26
27
|
|
27
28
|
```ruby
|
28
|
-
gem 'go-on-rails', '~> 0.1.
|
29
|
+
gem 'go-on-rails', '~> 0.1.9'
|
29
30
|
```
|
30
31
|
|
31
32
|
And then execute:
|
@@ -43,7 +43,7 @@ type <%= @model_name %>Page struct {
|
|
43
43
|
orderStr string
|
44
44
|
}
|
45
45
|
|
46
|
-
// Current
|
46
|
+
// Current get the current page of <%= @model_name %>Page object for pagination
|
47
47
|
func (_p *<%= @model_name %>Page) Current() ([]<%= @model_name %>, error) {
|
48
48
|
if _, exist := _p.Order["id"]; !exist {
|
49
49
|
return nil, errors.New("No id order specified in Order map")
|
@@ -73,7 +73,7 @@ func (_p *<%= @model_name %>Page) Current() ([]<%= @model_name %>, error) {
|
|
73
73
|
return <%= var_pmn %>, nil
|
74
74
|
}
|
75
75
|
|
76
|
-
// Previous
|
76
|
+
// Previous get the previous page of <%= @model_name %>Page object for pagination
|
77
77
|
func (_p *<%= @model_name %>Page) Previous() ([]<%= @model_name %>, error) {
|
78
78
|
if _p.PageNum == 0 {
|
79
79
|
return nil, errors.New("This's the first page, no previous page yet")
|
@@ -107,7 +107,7 @@ func (_p *<%= @model_name %>Page) Previous() ([]<%= @model_name %>, error) {
|
|
107
107
|
return <%= var_pmn %>, nil
|
108
108
|
}
|
109
109
|
|
110
|
-
// Next
|
110
|
+
// Next get the next page of <%= @model_name %>Page object for pagination
|
111
111
|
func (_p *<%= @model_name %>Page) Next() ([]<%= @model_name %>, error) {
|
112
112
|
if _p.PageNum == _p.TotalPages-1 {
|
113
113
|
return nil, errors.New("This's the last page, no next page yet")
|
@@ -141,7 +141,7 @@ func (_p *<%= @model_name %>Page) Next() ([]<%= @model_name %>, error) {
|
|
141
141
|
return <%= var_pmn %>, nil
|
142
142
|
}
|
143
143
|
|
144
|
-
// GetPage
|
144
|
+
// GetPage is a helper function for the <%= @model_name %>Page object to return a corresponding page due to
|
145
145
|
// the parameter passed in, one of "previous, current or next"
|
146
146
|
func (_p *<%= @model_name %>Page) GetPage(direction string) (ps []<%= @model_name %>, err error) {
|
147
147
|
switch direction {
|
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.10
|
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-09 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
|