goon_model_gen 0.3.1 → 0.4.0
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/builder/abstract_builder.rb +5 -1
- data/lib/goon_model_gen/builder/converter_builder.rb +6 -5
- data/lib/goon_model_gen/builder/model_builder.rb +8 -2
- data/lib/goon_model_gen/builder/store_builder.rb +6 -5
- data/lib/goon_model_gen/builder/validation_builder.rb +8 -2
- data/lib/goon_model_gen/cli.rb +6 -6
- data/lib/goon_model_gen/config.rb +5 -0
- data/lib/goon_model_gen/generator.rb +2 -1
- data/lib/goon_model_gen/golang/datastore_package_factory.rb +49 -0
- data/lib/goon_model_gen/golang/datastore_supported.rb +0 -38
- data/lib/goon_model_gen/golang/structs_loader.rb +11 -4
- data/lib/goon_model_gen/package_alias_map.rb +16 -0
- data/lib/goon_model_gen/templates/dsl.rb +1 -0
- data/lib/goon_model_gen/templates/store/goon/01_Binder.go.erb +1 -1
- data/lib/goon_model_gen/templates/store/goon/05_Query.go.erb +1 -1
- data/lib/goon_model_gen/templates/store/goon/06_Run.go.erb +2 -2
- data/lib/goon_model_gen/templates/store/goon/08_AllBy.go.erb +2 -2
- data/lib/goon_model_gen/templates/store/goon/09_Select.go.erb +1 -1
- data/lib/goon_model_gen/templates/store/goon/10_FirstBy.go.erb +1 -1
- data/lib/goon_model_gen/templates/store/goon/11_CountBy.go.erb +3 -3
- data/lib/goon_model_gen/templates/store/goon/13_ByKey.go.erb +2 -2
- data/lib/goon_model_gen/templates/store/goon/14_Get.go.erb +3 -3
- data/lib/goon_model_gen/templates/store/goon/15_IsValidKey.go.erb +3 -3
- data/lib/goon_model_gen/templates/store/goon/16_Exist.go.erb +3 -3
- data/lib/goon_model_gen/templates/store/goon/17_Save.go.erb +1 -1
- data/lib/goon_model_gen/templates/store/goon/18_Create.go.erb +2 -2
- data/lib/goon_model_gen/templates/store/goon/19_Update.go.erb +2 -2
- data/lib/goon_model_gen/templates/store/goon/20_PutWith.go.erb +1 -1
- data/lib/goon_model_gen/templates/store/goon/21_Put.go.erb +3 -3
- data/lib/goon_model_gen/templates/store/goon/22_Delete.go.erb +2 -2
- data/lib/goon_model_gen/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2557ac8ac046e13e329e88beec214ba39722a44df2abefadbb27e1902900cac2
|
4
|
+
data.tar.gz: b4b8ab91096ecc634235b6eb32f1e467bc76235b3fd83c72dc2f66a6d5cef1f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f178d805cec2fd66bffe10924b17d2dbcddd8c58d9c9ac92ccfd1e666152751f2c6ee7de439b2d4eb68232e60a3b71edc88a976294cf3bc196a67e366d1777e9
|
7
|
+
data.tar.gz: fd8ed7be54ca836152593a61719ec081e90897aa1ba646149ba49402d2b3a9e86ad21c29e5d21d0d05bcd2a0efba5fe52768e7a3ffaa4377a34f780953282678
|
@@ -1,15 +1,19 @@
|
|
1
1
|
require "goon_model_gen"
|
2
2
|
|
3
|
+
require "goon_model_gen/config"
|
3
4
|
require "goon_model_gen/golang/packages"
|
4
5
|
|
5
6
|
module GoonModelGen
|
6
7
|
module Builder
|
7
8
|
class AbstractBuilder
|
9
|
+
attr_reader :config
|
8
10
|
attr_reader :base_package_path
|
9
11
|
attr_accessor :package_suffix
|
10
12
|
|
13
|
+
# @param config [GoonModelGen::Config]
|
11
14
|
# @param base_package_path [String]
|
12
|
-
def initialize(base_package_path)
|
15
|
+
def initialize(config, base_package_path)
|
16
|
+
@config = config
|
13
17
|
@base_package_path = base_package_path
|
14
18
|
end
|
15
19
|
|
@@ -1,11 +1,12 @@
|
|
1
1
|
require "goon_model_gen"
|
2
2
|
|
3
|
+
require "goon_model_gen/config"
|
3
4
|
require "goon_model_gen/builder/abstract_builder"
|
4
5
|
|
5
6
|
require "goon_model_gen/source/struct"
|
6
7
|
|
7
8
|
require "goon_model_gen/golang/package"
|
8
|
-
require "goon_model_gen/golang/
|
9
|
+
require "goon_model_gen/golang/datastore_package_factory"
|
9
10
|
|
10
11
|
|
11
12
|
module GoonModelGen
|
@@ -14,11 +15,11 @@ module GoonModelGen
|
|
14
15
|
attr_reader :loader
|
15
16
|
attr_reader :packages
|
16
17
|
|
17
|
-
# @param
|
18
|
+
# @param config [GoonModelGen::Config]
|
18
19
|
# @param loader [Converter::Loader]
|
19
20
|
# @param packages [Golang::Packages]
|
20
|
-
def initialize(
|
21
|
-
super(
|
21
|
+
def initialize(config, loader, packages)
|
22
|
+
super(config, config.converter_package_path)
|
22
23
|
@package_suffix = "_conv"
|
23
24
|
@loader = loader
|
24
25
|
@packages = packages
|
@@ -70,7 +71,7 @@ module GoonModelGen
|
|
70
71
|
|
71
72
|
# @param pkgs [Golang::Packages]
|
72
73
|
def resolve_type_names(pkgs)
|
73
|
-
pkgs.resolve_type_names(Golang::
|
74
|
+
pkgs.resolve_type_names(Golang::DatastorePackageFactory.new(config.package_alias_map).packages.dup.add(packages))
|
74
75
|
end
|
75
76
|
|
76
77
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require "goon_model_gen"
|
2
2
|
|
3
|
+
require "goon_model_gen/config"
|
3
4
|
require "goon_model_gen/builder/abstract_builder"
|
4
5
|
|
5
6
|
require "goon_model_gen/source/struct"
|
@@ -8,7 +9,7 @@ require "goon_model_gen/source/named_slice"
|
|
8
9
|
|
9
10
|
require "goon_model_gen/golang/package"
|
10
11
|
require "goon_model_gen/golang/packages"
|
11
|
-
require "goon_model_gen/golang/
|
12
|
+
require "goon_model_gen/golang/datastore_package_factory"
|
12
13
|
|
13
14
|
require "active_support/core_ext/string"
|
14
15
|
|
@@ -16,6 +17,11 @@ module GoonModelGen
|
|
16
17
|
module Builder
|
17
18
|
class ModelBuilder < AbstractBuilder
|
18
19
|
|
20
|
+
# @param config [GoonModelGen::Config]
|
21
|
+
def initialize(config)
|
22
|
+
super(config, config.model_package_path)
|
23
|
+
end
|
24
|
+
|
19
25
|
# @param package_path [String]
|
20
26
|
# @param types [Array<Source::Type>]
|
21
27
|
# @return [Golang::Package, Array<Proc>]
|
@@ -46,7 +52,7 @@ module GoonModelGen
|
|
46
52
|
|
47
53
|
# @param pkgs [Golang::Packages]
|
48
54
|
def resolve_type_names(pkgs)
|
49
|
-
pkgs.resolve_type_names(Golang::
|
55
|
+
pkgs.resolve_type_names(Golang::DatastorePackageFactory.new(config.package_alias_map).packages)
|
50
56
|
end
|
51
57
|
|
52
58
|
# @param t [Source::Struct]
|
@@ -1,11 +1,12 @@
|
|
1
1
|
require "goon_model_gen"
|
2
2
|
|
3
|
+
require "goon_model_gen/config"
|
3
4
|
require "goon_model_gen/builder/abstract_builder"
|
4
5
|
|
5
6
|
require "goon_model_gen/source/struct"
|
6
7
|
|
7
8
|
require "goon_model_gen/golang/package"
|
8
|
-
require "goon_model_gen/golang/
|
9
|
+
require "goon_model_gen/golang/datastore_package_factory"
|
9
10
|
|
10
11
|
|
11
12
|
module GoonModelGen
|
@@ -13,10 +14,10 @@ module GoonModelGen
|
|
13
14
|
class StoreBuilder < AbstractBuilder
|
14
15
|
attr_reader :model_packages
|
15
16
|
|
16
|
-
# @param
|
17
|
+
# @param config [GoonModelGen::Config]
|
17
18
|
# @param model_packages [Golang::Packages]
|
18
|
-
def initialize(
|
19
|
-
super(
|
19
|
+
def initialize(config, model_packages)
|
20
|
+
super(config, config.store_package_path)
|
20
21
|
@package_suffix = "_store"
|
21
22
|
@model_packages = model_packages
|
22
23
|
end
|
@@ -44,7 +45,7 @@ module GoonModelGen
|
|
44
45
|
|
45
46
|
# @param pkgs [Golang::Packages]
|
46
47
|
def resolve_type_names(pkgs)
|
47
|
-
pkgs.resolve_type_names(Golang::
|
48
|
+
pkgs.resolve_type_names(Golang::DatastorePackageFactory.new(config.package_alias_map).packages.dup.add(model_packages))
|
48
49
|
end
|
49
50
|
|
50
51
|
end
|
@@ -1,15 +1,21 @@
|
|
1
1
|
require "goon_model_gen"
|
2
2
|
|
3
|
+
require "goon_model_gen/config"
|
3
4
|
require "goon_model_gen/builder/abstract_builder"
|
4
5
|
|
5
6
|
require "goon_model_gen/golang/packages"
|
6
|
-
require "goon_model_gen/golang/
|
7
|
+
require "goon_model_gen/golang/datastore_package_factory"
|
7
8
|
|
8
9
|
|
9
10
|
module GoonModelGen
|
10
11
|
module Builder
|
11
12
|
class ValidationBuilder < AbstractBuilder
|
12
13
|
|
14
|
+
# @param config [GoonModelGen::Config]
|
15
|
+
def initialize(config)
|
16
|
+
super(config, config.validation_package_path)
|
17
|
+
end
|
18
|
+
|
13
19
|
# @return [Golang::Packages]
|
14
20
|
def build(*)
|
15
21
|
Golang::Packages.new.tap do |r|
|
@@ -24,7 +30,7 @@ module GoonModelGen
|
|
24
30
|
|
25
31
|
# @param pkgs [Golang::Packages]
|
26
32
|
def resolve_type_names(pkgs)
|
27
|
-
pkgs.resolve_type_names(Golang::
|
33
|
+
pkgs.resolve_type_names(Golang::DatastorePackageFactory.new(config.package_alias_map).packages)
|
28
34
|
end
|
29
35
|
|
30
36
|
end
|
data/lib/goon_model_gen/cli.rb
CHANGED
@@ -65,11 +65,11 @@ module GoonModelGen
|
|
65
65
|
option :inspect, type: :boolean, desc: "Don't generate any file and show package objects if given"
|
66
66
|
def converter(*paths)
|
67
67
|
loader = Converter::Loader.new(cfg)
|
68
|
-
package_hash = Golang::StructsLoader.new
|
68
|
+
package_hash = Golang::StructsLoader.new(cfg).process # Golang::Packages
|
69
69
|
packages = Golang::Packages.wrap(package_hash.values.flatten)
|
70
70
|
converter_package = packages.find_or_new(cfg.converter_package_path)
|
71
71
|
|
72
|
-
b = Builder::ConverterBuilder.new(cfg
|
72
|
+
b = Builder::ConverterBuilder.new(cfg, loader, Golang::Packages.new.add(*packages))
|
73
73
|
conv_packages = b.build(paths)
|
74
74
|
|
75
75
|
if options[:inspect]
|
@@ -97,15 +97,15 @@ module GoonModelGen
|
|
97
97
|
# @return [Array<Golang::Package>]
|
98
98
|
def build_model_objects(paths)
|
99
99
|
context = Source::Loader.new.process(paths)
|
100
|
-
Builder::ModelBuilder.new(cfg
|
100
|
+
Builder::ModelBuilder.new(cfg).build(context)
|
101
101
|
end
|
102
102
|
|
103
103
|
# @param paths [Array<String>] Source::Context
|
104
104
|
# @return [Array<Golang::Package>]
|
105
105
|
def build_store_packages(paths)
|
106
106
|
context = Source::Loader.new.process(paths)
|
107
|
-
model_packages = Builder::ModelBuilder.new(cfg
|
108
|
-
store_packages = Builder::StoreBuilder.new(cfg
|
107
|
+
model_packages = Builder::ModelBuilder.new(cfg).build(context)
|
108
|
+
store_packages = Builder::StoreBuilder.new(cfg, model_packages).build(context)
|
109
109
|
return store_packages
|
110
110
|
end
|
111
111
|
|
@@ -123,7 +123,7 @@ module GoonModelGen
|
|
123
123
|
|
124
124
|
# @return [Golang::Package]
|
125
125
|
def validation_packages
|
126
|
-
Builder::ValidationBuilder.new(cfg
|
126
|
+
Builder::ValidationBuilder.new(cfg).build
|
127
127
|
end
|
128
128
|
end
|
129
129
|
end
|
@@ -5,6 +5,7 @@ require "yaml"
|
|
5
5
|
require "pathname"
|
6
6
|
|
7
7
|
require "goon_model_gen/golang"
|
8
|
+
require "goon_model_gen/package_alias_map"
|
8
9
|
|
9
10
|
module GoonModelGen
|
10
11
|
class Config
|
@@ -26,6 +27,7 @@ module GoonModelGen
|
|
26
27
|
structs_json_path
|
27
28
|
validator_package_path
|
28
29
|
version_comment
|
30
|
+
package_alias_map
|
29
31
|
].freeze
|
30
32
|
|
31
33
|
attr_accessor *ATTRIBUTES
|
@@ -46,6 +48,9 @@ module GoonModelGen
|
|
46
48
|
@structs_gen_dir ||= "./cmd/structs"
|
47
49
|
@structs_json_path ||= "./structs.json"
|
48
50
|
@version_comment ||= false
|
51
|
+
@package_alias_map ||= {}
|
52
|
+
@package_alias_map = PACKAGE_ALIAS_MAP.merge(@package_alias_map)
|
53
|
+
@package_alias_map.default_proc = proc{|hash,key| key.to_s}
|
49
54
|
self
|
50
55
|
end
|
51
56
|
|
@@ -15,6 +15,7 @@ module GoonModelGen
|
|
15
15
|
attr_accessor :version_comment # false/true
|
16
16
|
attr_accessor :force, :skip # false/true
|
17
17
|
attr_accessor :overwrite_custom_file # false/true
|
18
|
+
attr_accessor :package_alias_map
|
18
19
|
|
19
20
|
DEFAULT_TEMPLATES_DIR = File.expand_path('../templates', __FILE__)
|
20
21
|
|
@@ -109,7 +110,7 @@ module GoonModelGen
|
|
109
110
|
|
110
111
|
# @param cfg [Config]
|
111
112
|
def load_config(cfg)
|
112
|
-
[:gofmt_disabled, :version_comment].each do |key|
|
113
|
+
[:gofmt_disabled, :version_comment, :package_alias_map].each do |key|
|
113
114
|
self.send("#{key}=", cfg.send(key))
|
114
115
|
end
|
115
116
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require "goon_model_gen"
|
2
|
+
|
3
|
+
require "goon_model_gen/golang/predeclared_type"
|
4
|
+
require "goon_model_gen/golang/datastore_supported"
|
5
|
+
require "goon_model_gen/golang/package"
|
6
|
+
require "goon_model_gen/golang/packages"
|
7
|
+
require "goon_model_gen/golang/builtin"
|
8
|
+
|
9
|
+
module GoonModelGen
|
10
|
+
module Golang
|
11
|
+
class DatastorePackageFactory
|
12
|
+
attr_reader :package_alias_map
|
13
|
+
def initialize(package_alias_map)
|
14
|
+
@package_alias_map = package_alias_map
|
15
|
+
end
|
16
|
+
|
17
|
+
def datastore
|
18
|
+
@datastore ||= Package.new(package_alias_map['datastore']).tap do |pkg|
|
19
|
+
pkg.add(DatastoreSupported.new('ByteString'))
|
20
|
+
pkg.add(DatastoreSupported.new('Key'))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def time
|
25
|
+
@time ||= Package.new('time').tap do |pkg|
|
26
|
+
pkg.add(DatastoreSupported.new('Time'))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def appengine
|
31
|
+
@appengine ||= Package.new(package_alias_map['appengine']).tap do |pkg|
|
32
|
+
pkg.add(DatastoreSupported.new('BlobKey'))
|
33
|
+
pkg.add(DatastoreSupported.new('GeoPoint'))
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
def packages
|
39
|
+
@packages ||= Packages.new.tap do |pkgs|
|
40
|
+
pkgs << Builtin.package
|
41
|
+
pkgs << datastore
|
42
|
+
pkgs << time
|
43
|
+
pkgs << appengine
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -1,48 +1,10 @@
|
|
1
1
|
require "goon_model_gen"
|
2
2
|
|
3
3
|
require "goon_model_gen/golang/predeclared_type"
|
4
|
-
require "goon_model_gen/golang/package"
|
5
|
-
require "goon_model_gen/golang/packages"
|
6
|
-
require "goon_model_gen/golang/builtin"
|
7
4
|
|
8
5
|
module GoonModelGen
|
9
6
|
module Golang
|
10
7
|
class DatastoreSupported < PredeclaredType
|
11
|
-
|
12
|
-
class << self
|
13
|
-
|
14
|
-
def datastore
|
15
|
-
@datastore ||= Package.new('google.golang.org/appengine/datastore').tap do |pkg|
|
16
|
-
pkg.add(self.new('ByteString'))
|
17
|
-
pkg.add(self.new('Key'))
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def time
|
22
|
-
@time ||= Package.new('time').tap do |pkg|
|
23
|
-
pkg.add(self.new('Time'))
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def appengine
|
28
|
-
@appengine ||= Package.new('google.golang.org/appengine').tap do |pkg|
|
29
|
-
pkg.add(self.new('BlobKey'))
|
30
|
-
pkg.add(self.new('GeoPoint'))
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
|
35
|
-
def packages
|
36
|
-
@packages ||= Packages.new.tap do |pkgs|
|
37
|
-
pkgs << Builtin.package
|
38
|
-
pkgs << datastore
|
39
|
-
pkgs << time
|
40
|
-
pkgs << appengine
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
8
|
end
|
47
9
|
end
|
48
10
|
end
|
@@ -3,8 +3,9 @@ require "goon_model_gen"
|
|
3
3
|
require "erb"
|
4
4
|
require "yaml"
|
5
5
|
|
6
|
+
require "goon_model_gen/config"
|
6
7
|
require "goon_model_gen/golang/packages"
|
7
|
-
require "goon_model_gen/golang/
|
8
|
+
require "goon_model_gen/golang/datastore_package_factory"
|
8
9
|
|
9
10
|
require "active_support/core_ext/string"
|
10
11
|
|
@@ -12,9 +13,15 @@ module GoonModelGen
|
|
12
13
|
module Golang
|
13
14
|
class StructsLoader
|
14
15
|
|
15
|
-
# @param
|
16
|
+
# @param cnoofig [GoonModelGen::Config]
|
17
|
+
def initialize(config)
|
18
|
+
@config = config
|
19
|
+
end
|
20
|
+
|
16
21
|
# @return [Hash<String,Packages>]
|
17
|
-
def process
|
22
|
+
def process
|
23
|
+
path = config.structs_json_path
|
24
|
+
|
18
25
|
erb = ERB.new(::File.read(path), nil, "-")
|
19
26
|
erb.filename = path
|
20
27
|
txt = erb.result
|
@@ -24,7 +31,7 @@ module GoonModelGen
|
|
24
31
|
d[key] = build_packages(types)
|
25
32
|
end
|
26
33
|
|
27
|
-
whole_packages = Golang::
|
34
|
+
whole_packages = Golang::DatastorePackageFactory.new(config.package_alias_map).packages.dup
|
28
35
|
r.values.each do |pkgs|
|
29
36
|
whole_packages.add(*pkgs)
|
30
37
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "goon_model_gen"
|
2
|
+
|
3
|
+
require "erb"
|
4
|
+
require "yaml"
|
5
|
+
require "pathname"
|
6
|
+
|
7
|
+
require "goon_model_gen/golang"
|
8
|
+
|
9
|
+
module GoonModelGen
|
10
|
+
PACKAGE_ALIAS_MAP = {
|
11
|
+
'appengine' => 'google.golang.org/appengine',
|
12
|
+
'datastore' => 'google.golang.org/appengine/datastore',
|
13
|
+
'log' => 'google.golang.org/appengine/log',
|
14
|
+
'goon' => 'github.com/mjibson/goon',
|
15
|
+
}
|
16
|
+
end
|
@@ -13,6 +13,7 @@ module GoonModelGen
|
|
13
13
|
package_path = package_or_nil || alias_or_package
|
14
14
|
new_alias = package_or_nil ? alias_or_package.to_s : nil
|
15
15
|
package_path = package_path.path if package_path.respond_to?(:path)
|
16
|
+
package_path = package_alias_map[package_path]
|
16
17
|
return if package_path.blank?
|
17
18
|
if dependencies.key?(package_path)
|
18
19
|
old_alias = dependencies[package_path]
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%-
|
2
2
|
import 'context'
|
3
3
|
import model.package
|
4
|
-
import '
|
5
|
-
import '
|
4
|
+
import 'datastore'
|
5
|
+
import 'log'
|
6
6
|
-%>
|
7
7
|
|
8
8
|
func (s *<%= type.name %>) AllBy(ctx context.Context, q *datastore.Query) ([]*<%= model.qualified_name %>, error) {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%-
|
2
2
|
import 'context'
|
3
|
-
import '
|
4
|
-
import '
|
5
|
-
import '
|
3
|
+
import 'datastore'
|
4
|
+
import 'log'
|
5
|
+
import 'goon'
|
6
6
|
-%>
|
7
7
|
|
8
8
|
func (s *<%= type.name %>) CountBy(ctx context.Context, q *datastore.Query) (int, error) {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%-
|
2
2
|
import 'context'
|
3
3
|
import model.package
|
4
|
-
import '
|
5
|
-
import '
|
4
|
+
import 'datastore'
|
5
|
+
import 'log'
|
6
6
|
-%>
|
7
7
|
|
8
8
|
func (s *<%= type.name %>) ByKey(ctx context.Context, key *datastore.Key) (*<%= model.qualified_name %>, error) {
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<%-
|
2
2
|
import 'context'
|
3
3
|
import model.package
|
4
|
-
import '
|
5
|
-
import '
|
6
|
-
import '
|
4
|
+
import 'datastore'
|
5
|
+
import 'log'
|
6
|
+
import 'goon'
|
7
7
|
-%>
|
8
8
|
|
9
9
|
func (s *<%= type.name %>) Get(ctx context.Context, m *<%= model.qualified_name %>) error {
|
@@ -2,9 +2,9 @@
|
|
2
2
|
import 'context'
|
3
3
|
import 'fmt'
|
4
4
|
import model.package
|
5
|
-
import '
|
6
|
-
import '
|
7
|
-
import '
|
5
|
+
import 'datastore'
|
6
|
+
import 'log'
|
7
|
+
import 'goon'
|
8
8
|
-%>
|
9
9
|
|
10
10
|
func (s *<%= type.name %>) IsValidKey(ctx context.Context, key *datastore.Key) error {
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<%-
|
2
2
|
import 'context'
|
3
3
|
import model.package
|
4
|
-
import '
|
5
|
-
import '
|
6
|
-
import '
|
4
|
+
import 'datastore'
|
5
|
+
import 'log'
|
6
|
+
import 'goon'
|
7
7
|
-%>
|
8
8
|
|
9
9
|
func (s *<%= type.name %>) Exist(ctx context.Context, m *<%= model.qualified_name %>) (bool, error) {
|
@@ -2,8 +2,8 @@
|
|
2
2
|
import 'context'
|
3
3
|
import 'fmt'
|
4
4
|
import model.package
|
5
|
-
import '
|
6
|
-
import '
|
5
|
+
import 'datastore'
|
6
|
+
import 'log'
|
7
7
|
-%>
|
8
8
|
|
9
9
|
func (s *<%= type.name %>) Create(ctx context.Context, m *<%= model.qualified_name %>) (*datastore.Key, error) {
|
@@ -2,8 +2,8 @@
|
|
2
2
|
import 'context'
|
3
3
|
import 'fmt'
|
4
4
|
import model.package
|
5
|
-
import '
|
6
|
-
import '
|
5
|
+
import 'datastore'
|
6
|
+
import 'log'
|
7
7
|
-%>
|
8
8
|
|
9
9
|
func (s *<%= type.name %>) Update(ctx context.Context, m *<%= model.qualified_name %>) (*datastore.Key, error) {
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<%-
|
2
2
|
import 'context'
|
3
3
|
import model.package
|
4
|
-
import '
|
5
|
-
import '
|
6
|
-
import '
|
4
|
+
import 'datastore'
|
5
|
+
import 'log'
|
6
|
+
import 'goon'
|
7
7
|
-%>
|
8
8
|
|
9
9
|
func (s *<%= type.name %>) Put(ctx context.Context, m *<%= model.qualified_name %>) (*datastore.Key, error) {
|
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.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- akm
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -161,6 +161,7 @@ files:
|
|
161
161
|
- lib/goon_model_gen/golang.rb
|
162
162
|
- lib/goon_model_gen/golang/builtin.rb
|
163
163
|
- lib/goon_model_gen/golang/combination_type.rb
|
164
|
+
- lib/goon_model_gen/golang/datastore_package_factory.rb
|
164
165
|
- lib/goon_model_gen/golang/datastore_supported.rb
|
165
166
|
- lib/goon_model_gen/golang/enum.rb
|
166
167
|
- lib/goon_model_gen/golang/field.rb
|
@@ -174,6 +175,7 @@ files:
|
|
174
175
|
- lib/goon_model_gen/golang/struct.rb
|
175
176
|
- lib/goon_model_gen/golang/structs_loader.rb
|
176
177
|
- lib/goon_model_gen/golang/type.rb
|
178
|
+
- lib/goon_model_gen/package_alias_map.rb
|
177
179
|
- lib/goon_model_gen/source/context.rb
|
178
180
|
- lib/goon_model_gen/source/contextual.rb
|
179
181
|
- lib/goon_model_gen/source/enum.rb
|