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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db078379e697d428bf713b0db6dea8854cd72407c52834e8678621a92e26bfe6
4
- data.tar.gz: 8ca351a31169cc47caee8e5e2690f48941e3cf40ed85c48b4ffa6dbb700e8cf4
3
+ metadata.gz: 30ff5d1f177beb2808103274f24fbcab5546bc3403528dd5a855c53569c78308
4
+ data.tar.gz: 70fbfb8a03c0955da7c90bc357854a4784e4228e2e086cd41423c10e7b4e55ee
5
5
  SHA512:
6
- metadata.gz: b48b45a7de8d6a9fad25d9250f922818da51278b358aff778a62308cb23f451251120a388d995f0e24dd041894297a3cd92281e02176d760903223d09c8ae25d
7
- data.tar.gz: e0683141e1492e76b91e22a097c48774816ed82da9dffd05c29b15fbd4eab31b4516f1662240ce9c2e195ac28d4a07b9025a37f72a2cdd1f101d5232fbd29d19
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 v
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
+ }
@@ -1,3 +1,3 @@
1
1
  module GoonModelGen
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
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.3
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-27 00:00:00.000000000 Z
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/17_Create.go.erb
227
- - lib/goon_model_gen/templates/store/goon/18_Update.go.erb
228
- - lib/goon_model_gen/templates/store/goon/19_PutWith.go.erb
229
- - lib/goon_model_gen/templates/store/goon/20_Put.go.erb
230
- - lib/goon_model_gen/templates/store/goon/21_Delete.go.erb
231
- - lib/goon_model_gen/templates/store/goon/22_ValidateUniqueness.go.erb
232
- - lib/goon_model_gen/templates/store/goon/23_Validate.go.erb
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