goon_model_gen 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/goon_model_gen/source/loader.rb +3 -1
- data/lib/goon_model_gen/templates/store/goon/17_Save.go.erb +13 -0
- data/lib/goon_model_gen/templates/store/goon/{17_Create.go.erb → 18_Create.go.erb} +0 -0
- data/lib/goon_model_gen/templates/store/goon/{18_Update.go.erb → 19_Update.go.erb} +0 -0
- data/lib/goon_model_gen/templates/store/goon/{19_PutWith.go.erb → 20_PutWith.go.erb} +0 -0
- data/lib/goon_model_gen/templates/store/goon/{20_Put.go.erb → 21_Put.go.erb} +0 -0
- data/lib/goon_model_gen/templates/store/goon/{21_Delete.go.erb → 22_Delete.go.erb} +0 -0
- data/lib/goon_model_gen/templates/store/goon/{22_ValidateUniqueness.go.erb → 23_ValidateUniqueness.go.erb} +0 -0
- data/lib/goon_model_gen/templates/store/goon/{23_Validate.go.erb → 24_Validate.go.erb} +0 -0
- data/lib/goon_model_gen/version.rb +1 -1
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30ff5d1f177beb2808103274f24fbcab5546bc3403528dd5a855c53569c78308
|
4
|
+
data.tar.gz: 70fbfb8a03c0955da7c90bc357854a4784e4228e2e086cd41423c10e7b4e55ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b48907ab44a614aa18d796b4d7133e3a8cc04bf1e395e9ff2415e8169a031cd52bd1a6896791c1a3ffc0298e612b49fff6a737e34a4891eacd9a37de37d96c5
|
7
|
+
data.tar.gz: e976a0d39384d350a6355a0c683ffacbb7aaabbed330ee4d832ac3011a9df005f66b6a2a05550cf98c3a79377b68c38f84ff164895d923de1240d0e9b187731a
|
@@ -62,7 +62,9 @@ module GoonModelGen
|
|
62
62
|
when false then {}
|
63
63
|
when nil, true then nil
|
64
64
|
when Array then v.each_with_object({}){|i,d| d[i] = true}
|
65
|
-
when Hash then
|
65
|
+
when Hash then
|
66
|
+
v.default = v.delete('default')
|
67
|
+
v
|
66
68
|
else raise "Invalid generates value in #{k.inspect}: #{v.inspect}"
|
67
69
|
end
|
68
70
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%-
|
2
|
+
import 'context'
|
3
|
+
import model.package
|
4
|
+
import 'google.golang.org/appengine/datastore'
|
5
|
+
-%>
|
6
|
+
|
7
|
+
func (s *<%= type.name %>) Save(ctx context.Context, m *<%= model.qualified_name %>) (*datastore.Key, error) {
|
8
|
+
if m.IsPersisted() {
|
9
|
+
return s.Update(ctx, m)
|
10
|
+
} else {
|
11
|
+
return s.Create(ctx, m)
|
12
|
+
}
|
13
|
+
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goon_model_gen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- akm
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -223,13 +223,14 @@ files:
|
|
223
223
|
- lib/goon_model_gen/templates/store/goon/14_Get.go.erb
|
224
224
|
- lib/goon_model_gen/templates/store/goon/15_IsValidKey.go.erb
|
225
225
|
- lib/goon_model_gen/templates/store/goon/16_Exist.go.erb
|
226
|
-
- lib/goon_model_gen/templates/store/goon/
|
227
|
-
- lib/goon_model_gen/templates/store/goon/
|
228
|
-
- lib/goon_model_gen/templates/store/goon/
|
229
|
-
- lib/goon_model_gen/templates/store/goon/
|
230
|
-
- lib/goon_model_gen/templates/store/goon/
|
231
|
-
- lib/goon_model_gen/templates/store/goon/
|
232
|
-
- lib/goon_model_gen/templates/store/goon/
|
226
|
+
- lib/goon_model_gen/templates/store/goon/17_Save.go.erb
|
227
|
+
- lib/goon_model_gen/templates/store/goon/18_Create.go.erb
|
228
|
+
- lib/goon_model_gen/templates/store/goon/19_Update.go.erb
|
229
|
+
- lib/goon_model_gen/templates/store/goon/20_PutWith.go.erb
|
230
|
+
- lib/goon_model_gen/templates/store/goon/21_Put.go.erb
|
231
|
+
- lib/goon_model_gen/templates/store/goon/22_Delete.go.erb
|
232
|
+
- lib/goon_model_gen/templates/store/goon/23_ValidateUniqueness.go.erb
|
233
|
+
- lib/goon_model_gen/templates/store/goon/24_Validate.go.erb
|
233
234
|
- lib/goon_model_gen/templates/validation/error/01_struct.go.erb
|
234
235
|
- lib/goon_model_gen/templates/validation/error/02_Error.go.erb
|
235
236
|
- lib/goon_model_gen/version.rb
|