aurora-data-api 0.1.3 → 0.1.4
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/Gemfile.lock +1 -1
- data/Rakefile +9 -1
- data/aurora-data-api.gemspec +1 -1
- data/example/Gemfile +1 -1
- data/example/Gemfile.lock +12 -4
- data/example/app/models/user.rb +1 -0
- data/exe/Steepfile +5 -0
- data/exe/aurora-data-api +2 -154
- data/exe/cli/aurora-data-api/converter.rb +70 -0
- data/exe/cli/aurora-data-api/model.rb +22 -0
- data/exe/cli/aurora-data-api/schema.rb +8 -0
- data/exe/cli/tool.rb +66 -0
- data/exe/sig/converter.rbs +25 -0
- data/exe/sig/fileutils.rbs +8 -0
- data/exe/sig/model.rbs +12 -0
- data/exe/sig/schema.rbs +9 -0
- data/exe/sig/thor.rbs +4 -0
- data/exe/sig/tool.rbs +21 -0
- data/exe/sig/type.rbs +1 -0
- data/exe/sig/version.rbs +1 -0
- data/lib/aurora-data-api/model.rb +4 -1
- data/lib/aurora-data-api/type/boolean.rb +8 -0
- data/lib/aurora-data-api/version.rb +1 -1
- data/lib/aurora-data-api.rb +1 -0
- data/sig/aurora-data-api.rbs +0 -14
- data/sig/aws.rbs +13 -0
- data/sig/model.rbs +22 -9
- data/sig/type.rbs +6 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fe5d2c5a9bbee26fe0eae247070e2a96420fb4ac77c64872dd8925d9f5b539c
|
4
|
+
data.tar.gz: f5bfc26bba7524189b4ebfd10d5f3474ba2d5f1eeb0c6b6ec976b41973214320
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3ff7d85e1cdf9eb5d054e2d636f95a0997aa2617b7e7307899029a046ce8608e6458d21c19e6d850f0bb22941da2e51b5a090ad5ca02d0ccaa2561e63579477
|
7
|
+
data.tar.gz: 67a5723d8fa0b6e08fe9672957cbc07155a5c3742241e36a5c33320523b4dcdfab78c26025e9998251663d9dfd9bd452534a9e59b9f328902f76a9702da75a5c
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -11,8 +11,16 @@ end
|
|
11
11
|
|
12
12
|
require "standard/rake"
|
13
13
|
|
14
|
-
task default: %i[test steep standard]
|
14
|
+
task default: %i[test steep steep_cli standard]
|
15
15
|
|
16
|
+
desc "Steep check lib"
|
16
17
|
task :steep do
|
17
18
|
sh "bundle exec steep check"
|
18
19
|
end
|
20
|
+
|
21
|
+
desc "Steep check exe/cli"
|
22
|
+
task :steep_cli do
|
23
|
+
FileUtils.cd "exe" do
|
24
|
+
sh "bundle exec steep check"
|
25
|
+
end
|
26
|
+
end
|
data/aurora-data-api.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
spec.bindir = "exe"
|
29
|
-
spec.executables =
|
29
|
+
spec.executables = "aurora-data-api"
|
30
30
|
spec.require_paths = ["lib"]
|
31
31
|
|
32
32
|
spec.add_dependency "aws-sdk-rdsdataservice", "~> 1.35.0"
|
data/example/Gemfile
CHANGED
data/example/Gemfile.lock
CHANGED
@@ -1,9 +1,14 @@
|
|
1
|
-
|
2
|
-
remote:
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
3
|
specs:
|
4
|
-
aurora-data-api (0.1.
|
4
|
+
aurora-data-api (0.1.3)
|
5
5
|
aws-sdk-rdsdataservice (~> 1.35.0)
|
6
6
|
thor
|
7
|
+
tzinfo
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
7
12
|
aws-eventstream (1.2.0)
|
8
13
|
aws-partitions (1.594.0)
|
9
14
|
aws-sdk-core (3.131.1)
|
@@ -19,6 +24,7 @@ GEM
|
|
19
24
|
aws-sigv4 (~> 1.1)
|
20
25
|
aws-sigv4 (1.5.0)
|
21
26
|
aws-eventstream (~> 1, >= 1.0.2)
|
27
|
+
concurrent-ruby (1.1.10)
|
22
28
|
jmespath (1.6.1)
|
23
29
|
power_assert (2.0.1)
|
24
30
|
rake (13.0.6)
|
@@ -29,12 +35,14 @@ GEM
|
|
29
35
|
rr (>= 1.1.1)
|
30
36
|
test-unit (>= 2.5.2)
|
31
37
|
thor (1.2.1)
|
38
|
+
tzinfo (2.0.4)
|
39
|
+
concurrent-ruby (~> 1.0)
|
32
40
|
|
33
41
|
PLATFORMS
|
34
42
|
x86_64-linux
|
35
43
|
|
36
44
|
DEPENDENCIES
|
37
|
-
aurora-data-api
|
45
|
+
aurora-data-api!
|
38
46
|
aws-sdk-lambda
|
39
47
|
rake
|
40
48
|
test-unit-rr
|
data/example/app/models/user.rb
CHANGED
data/exe/Steepfile
ADDED
data/exe/aurora-data-api
CHANGED
@@ -1,160 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require "aurora-data-api/version"
|
4
|
-
require "
|
5
|
-
require "date"
|
6
|
-
require "fileutils"
|
4
|
+
require "aurora-data-api/type/boolean"
|
7
5
|
|
8
|
-
|
9
|
-
class Error < StandardError; end
|
10
|
-
|
11
|
-
class Schema
|
12
|
-
CREATE_TABLE = []
|
13
|
-
ALTER_TABLE = []
|
14
|
-
end
|
15
|
-
|
16
|
-
class Model
|
17
|
-
SCHEMA = {literal_id: :id}
|
18
|
-
|
19
|
-
def self.literal_id(lit)
|
20
|
-
SCHEMA[:literal_id] = lit
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.table(name)
|
24
|
-
SCHEMA[:table_name] = name
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.schema(&block)
|
28
|
-
converter = Converter.new(SCHEMA, self)
|
29
|
-
converter.head
|
30
|
-
converter.instance_eval(&block)
|
31
|
-
converter.tail
|
32
|
-
Schema::CREATE_TABLE << converter.create_table
|
33
|
-
Schema::ALTER_TABLE << converter.alter_table
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
class Converter
|
38
|
-
TYPES = {
|
39
|
-
::Date => "date",
|
40
|
-
::Time => "timestamp with time zone",
|
41
|
-
::String => "text",
|
42
|
-
::Integer => "bigint",
|
43
|
-
::Float => "double precision"
|
44
|
-
}
|
45
|
-
|
46
|
-
def initialize(schema, klass)
|
47
|
-
@table_name = schema[:table_name] || "#{klass.name.downcase}s"
|
48
|
-
@literal_id = schema[:literal_id]
|
49
|
-
@create_table = []
|
50
|
-
@alter_table = []
|
51
|
-
end
|
52
|
-
|
53
|
-
attr_reader :create_table, :alter_table
|
54
|
-
|
55
|
-
def head
|
56
|
-
@create_table << %/CREATE TABLE "#{@table_name}" (/
|
57
|
-
@create_table << %( "#{@literal_id}" bigint NOT NULL GENERATED ALWAYS AS IDENTITY,)
|
58
|
-
end
|
59
|
-
|
60
|
-
def tail
|
61
|
-
@create_table << %/ PRIMARY KEY ("#{@literal_id}")/
|
62
|
-
@create_table << %/);\n/
|
63
|
-
end
|
64
|
-
|
65
|
-
def timestamp
|
66
|
-
@create_table << %( "created_at" #{TYPES[Time]} NOT NULL,)
|
67
|
-
@create_table << %( "updated_at" #{TYPES[Time]} NOT NULL,)
|
68
|
-
end
|
69
|
-
|
70
|
-
def col(name, type, **params)
|
71
|
-
line = " "
|
72
|
-
case type
|
73
|
-
when Symbol
|
74
|
-
col_name = "#{name}_#{@literal_id}"
|
75
|
-
line << %("#{col_name}" )
|
76
|
-
line << TYPES[Integer]
|
77
|
-
@alter_table << %/ALTER TABLE ONLY "#{@table_name}" ADD CONSTRAINT "#{@table_name}_#{col_name}_fkey" FOREIGN KEY ("#{col_name}") REFERENCES "#{params[:table]}" ("#{@literal_id}");/
|
78
|
-
else
|
79
|
-
line << %("#{name}" )
|
80
|
-
line << TYPES[type]
|
81
|
-
end
|
82
|
-
params.each do |k, v|
|
83
|
-
case k
|
84
|
-
when :null
|
85
|
-
line << " NOT NULL" unless v
|
86
|
-
when :default
|
87
|
-
line << " DEFAULT "
|
88
|
-
line << case v
|
89
|
-
when String, Symbol
|
90
|
-
"'#{v}'"
|
91
|
-
else
|
92
|
-
v.to_s
|
93
|
-
end
|
94
|
-
when :unique
|
95
|
-
line << " UNIQUE" if v
|
96
|
-
end
|
97
|
-
end
|
98
|
-
line << ","
|
99
|
-
@create_table << line
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
class Tool < Thor
|
104
|
-
DEFAULT_MODELS_DIR = "app/models"
|
105
|
-
DEFAULT_OUTPUT_PATH = "db/schema.sql"
|
106
|
-
|
107
|
-
desc "version", "Print version"
|
108
|
-
def version
|
109
|
-
puts "aurora-data-api v#{AuroraDataApi::VERSION}"
|
110
|
-
end
|
111
|
-
|
112
|
-
desc "export", "Overwrite #{DEFAULT_OUTPUT_PATH} by aggregating #{DEFAULT_MODELS_DIR}/*.rb"
|
113
|
-
option :models, aliases: :m, default: DEFAULT_MODELS_DIR
|
114
|
-
option :output, aliases: :o, default: DEFAULT_OUTPUT_PATH
|
115
|
-
def export
|
116
|
-
models_dir = options[:models]
|
117
|
-
output_path = options[:output]
|
118
|
-
Dir.glob("#{models_dir}/*.rb").each do |rb|
|
119
|
-
load rb
|
120
|
-
end
|
121
|
-
if Schema::CREATE_TABLE.empty? && Schema::ALTER_TABLE.empty?
|
122
|
-
puts "Nothing to be exported."
|
123
|
-
exit 1
|
124
|
-
end
|
125
|
-
overwrite = false
|
126
|
-
if File.exist? output_path
|
127
|
-
print "#{output_path} exists. Overwrite? [Y/n]: "
|
128
|
-
answer = $stdin.gets.chomp
|
129
|
-
if %w[Y y yes].include?(answer.chomp)
|
130
|
-
overwrite = true
|
131
|
-
else
|
132
|
-
puts "Abort."
|
133
|
-
exit 1
|
134
|
-
end
|
135
|
-
else
|
136
|
-
FileUtils.touch output_path
|
137
|
-
overwrite = true
|
138
|
-
end
|
139
|
-
if overwrite
|
140
|
-
File.open output_path, "w" do |f|
|
141
|
-
f.write <<~COMMENT
|
142
|
-
/*
|
143
|
-
* This file was automatically genarated by the command:
|
144
|
-
* aurora-data-api export --models #{models_dir} --output #{output_path}
|
145
|
-
*
|
146
|
-
* Genarated at #{Time.now}
|
147
|
-
*
|
148
|
-
* https://github.com/hasumikin/aurora-data-api
|
149
|
-
*/\n
|
150
|
-
COMMENT
|
151
|
-
f.write Schema::CREATE_TABLE.flatten.join("\n")
|
152
|
-
f.write "\n"
|
153
|
-
f.write Schema::ALTER_TABLE.flatten.join("\n")
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
158
|
-
end
|
6
|
+
require_relative "cli/tool"
|
159
7
|
|
160
8
|
AuroraDataApi::Tool.start
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require "date"
|
2
|
+
|
3
|
+
module AuroraDataApi
|
4
|
+
class Converter
|
5
|
+
TYPES = {
|
6
|
+
::Date => "date",
|
7
|
+
::Time => "timestamp with time zone",
|
8
|
+
::String => "text",
|
9
|
+
::Integer => "bigint",
|
10
|
+
::Float => "double precision",
|
11
|
+
::AuroraDataApi::Type::Boolean => "boolean"
|
12
|
+
}
|
13
|
+
|
14
|
+
def initialize(schema, klass)
|
15
|
+
@table_name = schema[:table_name] || "#{klass.name.downcase}s"
|
16
|
+
@literal_id = schema[:literal_id]
|
17
|
+
@create_table = []
|
18
|
+
@alter_table = []
|
19
|
+
end
|
20
|
+
|
21
|
+
attr_reader :create_table, :alter_table
|
22
|
+
|
23
|
+
def head
|
24
|
+
@create_table << %/CREATE TABLE "#{@table_name}" (/
|
25
|
+
@create_table << %( "#{@literal_id}" bigint NOT NULL GENERATED ALWAYS AS IDENTITY,)
|
26
|
+
end
|
27
|
+
|
28
|
+
def tail
|
29
|
+
@create_table << %/ PRIMARY KEY ("#{@literal_id}")/
|
30
|
+
@create_table << %/);\n/
|
31
|
+
end
|
32
|
+
|
33
|
+
def timestamp
|
34
|
+
@create_table << %( "created_at" #{TYPES[Time]} NOT NULL,)
|
35
|
+
@create_table << %( "updated_at" #{TYPES[Time]} NOT NULL,)
|
36
|
+
end
|
37
|
+
|
38
|
+
def col(name, type, **params)
|
39
|
+
line = " "
|
40
|
+
case type
|
41
|
+
when Symbol
|
42
|
+
col_name = "#{name}_#{@literal_id}"
|
43
|
+
line << %("#{col_name}" )
|
44
|
+
line << TYPES[Integer]
|
45
|
+
@alter_table << %/ALTER TABLE ONLY "#{@table_name}" ADD CONSTRAINT "#{@table_name}_#{col_name}_fkey" FOREIGN KEY ("#{col_name}") REFERENCES "#{params[:table]}" ("#{@literal_id}");/
|
46
|
+
else
|
47
|
+
line << %("#{name}" )
|
48
|
+
line << TYPES[type]
|
49
|
+
end
|
50
|
+
params.each do |k, v|
|
51
|
+
case k
|
52
|
+
when :null
|
53
|
+
line << " NOT NULL" unless v
|
54
|
+
when :default
|
55
|
+
line << " DEFAULT "
|
56
|
+
line << case v
|
57
|
+
when String, Symbol
|
58
|
+
"'#{v}'"
|
59
|
+
else
|
60
|
+
v.to_s
|
61
|
+
end
|
62
|
+
when :unique
|
63
|
+
line << " UNIQUE" if v
|
64
|
+
end
|
65
|
+
end
|
66
|
+
line << ","
|
67
|
+
@create_table << line
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module AuroraDataApi
|
2
|
+
class Model
|
3
|
+
SCHEMA = {literal_id: :id}
|
4
|
+
|
5
|
+
def self.literal_id(lit)
|
6
|
+
SCHEMA[:literal_id] = lit
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.table(name)
|
10
|
+
SCHEMA[:table_name] = name
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.schema(&block)
|
14
|
+
converter = Converter.new(SCHEMA, self)
|
15
|
+
converter.head
|
16
|
+
converter.instance_eval(&block)
|
17
|
+
converter.tail
|
18
|
+
Schema::CREATE_TABLE << converter.create_table
|
19
|
+
Schema::ALTER_TABLE << converter.alter_table
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/exe/cli/tool.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
require "thor"
|
2
|
+
require "fileutils"
|
3
|
+
|
4
|
+
require_relative "aurora-data-api/converter"
|
5
|
+
require_relative "aurora-data-api/model"
|
6
|
+
require_relative "aurora-data-api/schema"
|
7
|
+
|
8
|
+
module AuroraDataApi
|
9
|
+
class Error < StandardError; end
|
10
|
+
|
11
|
+
class Tool < Thor
|
12
|
+
DEFAULT_MODELS_DIR = "app/models"
|
13
|
+
DEFAULT_OUTPUT_PATH = "db/schema.sql"
|
14
|
+
|
15
|
+
desc "version", "Print version"
|
16
|
+
def version
|
17
|
+
puts "aurora-data-api v#{AuroraDataApi::VERSION}"
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "export", "Overwrite #{DEFAULT_OUTPUT_PATH} by aggregating #{DEFAULT_MODELS_DIR}/*.rb"
|
21
|
+
option :models, aliases: :m, default: DEFAULT_MODELS_DIR
|
22
|
+
option :output, aliases: :o, default: DEFAULT_OUTPUT_PATH
|
23
|
+
def export
|
24
|
+
models_dir = options[:models]
|
25
|
+
output_path = options[:output]
|
26
|
+
Dir.glob("#{models_dir}/*.rb").each do |rb|
|
27
|
+
load rb
|
28
|
+
end
|
29
|
+
if Schema::CREATE_TABLE.empty? && Schema::ALTER_TABLE.empty?
|
30
|
+
puts "Nothing to be exported."
|
31
|
+
exit 1
|
32
|
+
end
|
33
|
+
overwrite = false
|
34
|
+
if File.exist? output_path
|
35
|
+
print "#{output_path} exists. Overwrite? [Y/n]: "
|
36
|
+
answer = $stdin.gets.chomp
|
37
|
+
if %w[Y y yes].include?(answer.chomp)
|
38
|
+
overwrite = true
|
39
|
+
else
|
40
|
+
puts "Abort."
|
41
|
+
exit 1
|
42
|
+
end
|
43
|
+
else
|
44
|
+
FileUtils.touch output_path
|
45
|
+
overwrite = true
|
46
|
+
end
|
47
|
+
if overwrite
|
48
|
+
File.open output_path, "w" do |f|
|
49
|
+
f.write <<~COMMENT
|
50
|
+
/*
|
51
|
+
* This file was automatically genarated by the command:
|
52
|
+
* aurora-data-api export --models #{models_dir} --output #{output_path}
|
53
|
+
*
|
54
|
+
* Genarated at #{Time.now}
|
55
|
+
*
|
56
|
+
* https://github.com/hasumikin/aurora-data-api
|
57
|
+
*/\n
|
58
|
+
COMMENT
|
59
|
+
f.write Schema::CREATE_TABLE.flatten.join("\n")
|
60
|
+
f.write "\n"
|
61
|
+
f.write Schema::ALTER_TABLE.flatten.join("\n")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# TypeProf 0.21.2
|
2
|
+
|
3
|
+
# Classes
|
4
|
+
module AuroraDataApi
|
5
|
+
class Converter
|
6
|
+
TYPES: Hash[singleton(Date)
|
7
|
+
| singleton(Float)
|
8
|
+
| singleton(Integer)
|
9
|
+
| singleton(String)
|
10
|
+
| singleton(Time)
|
11
|
+
| singleton(AuroraDataApi::Type::Boolean),
|
12
|
+
String]
|
13
|
+
@table_name: String
|
14
|
+
@literal_id: untyped
|
15
|
+
|
16
|
+
def initialize: (untyped schema, untyped klass) -> void
|
17
|
+
attr_reader create_table: Array[String]
|
18
|
+
attr_reader alter_table: Array[String]
|
19
|
+
def head: -> Array[String]
|
20
|
+
def tail: -> Array[String]
|
21
|
+
def timestamp: -> Array[String]
|
22
|
+
def col: (untyped name, untyped `type`, **untyped) -> Array[String]
|
23
|
+
def instance_eval: () { () -> void } -> void
|
24
|
+
end
|
25
|
+
end
|
data/exe/sig/model.rbs
ADDED
data/exe/sig/schema.rbs
ADDED
data/exe/sig/thor.rbs
ADDED
data/exe/sig/tool.rbs
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# TypeProf 0.21.2
|
2
|
+
|
3
|
+
# Global variables
|
4
|
+
$thor_runner: false
|
5
|
+
|
6
|
+
# Classes
|
7
|
+
module AuroraDataApi
|
8
|
+
class Error < StandardError
|
9
|
+
end
|
10
|
+
|
11
|
+
class Tool < Thor
|
12
|
+
DEFAULT_MODELS_DIR: String
|
13
|
+
DEFAULT_OUTPUT_PATH: String
|
14
|
+
|
15
|
+
def self.option: (:models | :output, aliases: Symbol, default: String) -> void
|
16
|
+
def options: -> Hash[:models | :output, String]
|
17
|
+
|
18
|
+
def version: -> nil
|
19
|
+
def export: -> void
|
20
|
+
end
|
21
|
+
end
|
data/exe/sig/type.rbs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
../../sig/type.rbs
|
data/exe/sig/version.rbs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
../../sig/version.rbs
|
@@ -55,6 +55,7 @@ module AuroraDataApi
|
|
55
55
|
def initialize(**params)
|
56
56
|
@struct = STRUCTS[self.class.model_name].new
|
57
57
|
@timestamp = %i[created_at updated_at].all? { |m| members.include?(m) }
|
58
|
+
# @type var params: Hash[Symbol, attribute_value]
|
58
59
|
params.each do |col, val|
|
59
60
|
if col == literal_id
|
60
61
|
@id = val if val.is_a?(Integer)
|
@@ -87,7 +88,9 @@ module AuroraDataApi
|
|
87
88
|
if string_name[-1] == "="
|
88
89
|
@struct[string_name.chop] = args[0]
|
89
90
|
elsif string_name[-3, 3] == "_#{literal_id}"
|
90
|
-
@struct[string_name.sub(/_#{literal_id}\z/, "")]
|
91
|
+
@struct[string_name.sub(/_#{literal_id}\z/, "")].then do |rel|
|
92
|
+
rel.is_a?(Model) ? rel.id : @struct[method_name]
|
93
|
+
end
|
91
94
|
elsif method_name == literal_id
|
92
95
|
@id
|
93
96
|
elsif members.include?(method_name)
|
data/lib/aurora-data-api.rb
CHANGED
@@ -4,6 +4,7 @@ require_relative "aurora-data-api/version"
|
|
4
4
|
require_relative "aurora-data-api/model"
|
5
5
|
require_relative "aurora-data-api/depot"
|
6
6
|
require_relative "aurora-data-api/data_service"
|
7
|
+
require_relative "aurora-data-api/type/boolean"
|
7
8
|
|
8
9
|
module AuroraDataApi
|
9
10
|
class Error < StandardError; end
|
data/sig/aurora-data-api.rbs
CHANGED
@@ -1,17 +1,3 @@
|
|
1
1
|
module AuroraDataApi
|
2
2
|
Error: StandardError
|
3
3
|
end
|
4
|
-
|
5
|
-
module Aws
|
6
|
-
def self.config: -> Hash[Symbol, untyped]
|
7
|
-
|
8
|
-
class Credentials
|
9
|
-
def initialize: (String, String) -> untyped
|
10
|
-
end
|
11
|
-
|
12
|
-
module RDSDataService
|
13
|
-
class Client
|
14
|
-
def initialize: (Hash[Symbol, String]) -> void
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/sig/aws.rbs
ADDED
data/sig/model.rbs
CHANGED
@@ -2,22 +2,38 @@
|
|
2
2
|
|
3
3
|
# Classes
|
4
4
|
module AuroraDataApi
|
5
|
-
type
|
5
|
+
type attribute_value = Model
|
6
|
+
| Symbol
|
7
|
+
| Time
|
8
|
+
| Date
|
9
|
+
| Integer
|
10
|
+
| Float
|
11
|
+
| Symbol
|
12
|
+
| bool
|
13
|
+
| nil
|
6
14
|
type attribute_type = singleton(String)
|
7
15
|
| singleton(Time)
|
8
16
|
| singleton(Date)
|
9
17
|
| singleton(Integer)
|
18
|
+
| singleton(Float)
|
19
|
+
| singleton(Type::Boolean)
|
10
20
|
| Symbol
|
11
21
|
|
22
|
+
class ModelStruct < Struct[untyped]
|
23
|
+
def []: (Symbol | String) -> attribute_value
|
24
|
+
def []=: (Symbol | String, attribute_value) -> void
|
25
|
+
def members: -> Array[Symbol]
|
26
|
+
end
|
27
|
+
|
12
28
|
class Model
|
13
29
|
SCHEMA: Hash[Symbol, untyped]
|
14
30
|
STRUCTS: Hash[Symbol, untyped]
|
15
|
-
@struct:
|
31
|
+
@struct: ModelStruct
|
16
32
|
|
17
33
|
type col_opt = Hash[:table, Symbol]
|
18
34
|
| Hash[:null, bool]
|
19
35
|
| Hash[:unique, bool]
|
20
|
-
| Hash[:default,
|
36
|
+
| Hash[:default, String | Integer | Float | bool | nil | Proc ]
|
21
37
|
|
22
38
|
def self.model_name: -> Symbol
|
23
39
|
def self.literal_id: (Symbol lit) -> Symbol
|
@@ -27,7 +43,7 @@ module AuroraDataApi
|
|
27
43
|
def self.col: (Symbol name, attribute_type type, ?col_opt opt) -> void
|
28
44
|
def self.timestamp: -> void
|
29
45
|
def self.relationship_by: (Symbol table_sym) -> [untyped, untyped]?
|
30
|
-
def initialize: (**Hash[Symbol,
|
46
|
+
def initialize: (**Hash[Symbol, attribute_value]) -> void
|
31
47
|
|
32
48
|
attr_reader id: Integer?
|
33
49
|
attr_reader timestamp: bool
|
@@ -40,12 +56,9 @@ module AuroraDataApi
|
|
40
56
|
def method_missing: (Symbol method_name, *untyped args) -> nil
|
41
57
|
def table_name: -> Symbol
|
42
58
|
def literal_id: -> Symbol
|
43
|
-
def build_params: (?include_id: bool) -> Hash[Symbol,
|
44
|
-
def attributes: -> Hash[Symbol,
|
59
|
+
def build_params: (?include_id: bool) -> Hash[Symbol, attribute_value]
|
60
|
+
def attributes: -> Hash[Symbol, attribute_value]
|
45
61
|
def _set_id: (Integer? id) -> void
|
46
62
|
def _destroy: -> bool
|
47
63
|
end
|
48
64
|
end
|
49
|
-
|
50
|
-
class AnonymousStruct_generated_1 < Struct[untyped]
|
51
|
-
end
|
data/sig/type.rbs
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aurora-data-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HASUMI Hitoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-rdsdataservice
|
@@ -93,18 +93,34 @@ files:
|
|
93
93
|
- example/package-lock.json
|
94
94
|
- example/package.json
|
95
95
|
- example/serverless.yml
|
96
|
+
- exe/Steepfile
|
96
97
|
- exe/aurora-data-api
|
98
|
+
- exe/cli/aurora-data-api/converter.rb
|
99
|
+
- exe/cli/aurora-data-api/model.rb
|
100
|
+
- exe/cli/aurora-data-api/schema.rb
|
101
|
+
- exe/cli/tool.rb
|
102
|
+
- exe/sig/converter.rbs
|
103
|
+
- exe/sig/fileutils.rbs
|
104
|
+
- exe/sig/model.rbs
|
105
|
+
- exe/sig/schema.rbs
|
106
|
+
- exe/sig/thor.rbs
|
107
|
+
- exe/sig/tool.rbs
|
108
|
+
- exe/sig/type.rbs
|
109
|
+
- exe/sig/version.rbs
|
97
110
|
- lib/aurora-data-api.rb
|
98
111
|
- lib/aurora-data-api/data_service.rb
|
99
112
|
- lib/aurora-data-api/depot.rb
|
100
113
|
- lib/aurora-data-api/environment.rb
|
101
114
|
- lib/aurora-data-api/model.rb
|
115
|
+
- lib/aurora-data-api/type/boolean.rb
|
102
116
|
- lib/aurora-data-api/version.rb
|
103
117
|
- sig/aurora-data-api.rbs
|
118
|
+
- sig/aws.rbs
|
104
119
|
- sig/data_service.rbs
|
105
120
|
- sig/depot.rbs
|
106
121
|
- sig/environment.rbs
|
107
122
|
- sig/model.rbs
|
123
|
+
- sig/type.rbs
|
108
124
|
- sig/tzinfo.rbs
|
109
125
|
- sig/version.rbs
|
110
126
|
homepage: https://github.com/hasumikin/aurora-data-api
|