skyward-orm 0.3.0 → 0.4.1
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/LICENSE +21 -0
- data/README.md +247 -60
- data/lib/skyward/orm/adapters/postgresql/connection.rb +64 -4
- data/lib/skyward/orm/adapters/postgresql.rb +189 -68
- data/lib/skyward/orm/adapters/sqlite/connection.rb +87 -0
- data/lib/skyward/orm/adapters/sqlite/constraints.rb +32 -14
- data/lib/skyward/orm/adapters/sqlite.rb +158 -45
- data/lib/skyward/orm/adapters/statement_cache.rb +51 -0
- data/lib/skyward/orm/adapters.rb +23 -7
- data/lib/skyward/orm/catalog/column.rb +2 -1
- data/lib/skyward/orm/cli/boot_file.rb +4 -4
- data/lib/skyward/orm/cli/migrate.rb +1 -1
- data/lib/skyward/orm/cli/migration.rb +8 -8
- data/lib/skyward/orm/cli/scaffold/source.rb +323 -0
- data/lib/skyward/orm/cli/scaffold.rb +70 -0
- data/lib/skyward/orm/cli/status.rb +5 -3
- data/lib/skyward/orm/commands.rb +20 -8
- data/lib/skyward/orm/connection/instrumented.rb +71 -0
- data/lib/skyward/orm/connection/pool.rb +2 -2
- data/lib/skyward/orm/connection/session.rb +74 -5
- data/lib/skyward/orm/database/decoders.rb +41 -0
- data/lib/skyward/orm/{connection/database → database}/schema_check.rb +22 -10
- data/lib/skyward/orm/{connection/database.rb → database.rb} +70 -36
- data/lib/skyward/orm/execution.rb +9 -0
- data/lib/skyward/orm/migrations/alter_table.rb +6 -2
- data/lib/skyward/orm/migrations/definitions.rb +20 -17
- data/lib/skyward/orm/migrations/diff.rb +156 -32
- data/lib/skyward/orm/migrations/directory.rb +5 -5
- data/lib/skyward/orm/migrations/rename_constraint.rb +8 -0
- data/lib/skyward/orm/migrations/runner.rb +21 -11
- data/lib/skyward/orm/migrations/script.rb +67 -27
- data/lib/skyward/orm/migrations/status.rb +38 -9
- data/lib/skyward/orm/migrations/summary.rb +23 -26
- data/lib/skyward/orm/migrations/versions.rb +3 -4
- data/lib/skyward/orm/migrations.rb +1 -1
- data/lib/skyward/orm/projection.rb +24 -11
- data/lib/skyward/orm/queries/clauses.rb +298 -124
- data/lib/skyward/orm/query.rb +2 -2
- data/lib/skyward/orm/record.rb +27 -9
- data/lib/skyward/orm/{placeholders.rb → statements/placeholders.rb} +4 -4
- data/lib/skyward/orm/statements.rb +178 -31
- data/lib/skyward/orm/tables/column.rb +2 -1
- data/lib/skyward/orm/tables/column_types.rb +63 -16
- data/lib/skyward/orm/tables/declarations.rb +43 -15
- data/lib/skyward/orm/{members.rb → tables/members.rb} +1 -1
- data/lib/skyward/orm/tables/rows.rb +28 -10
- data/lib/skyward/orm/tables/sources.rb +63 -0
- data/lib/skyward/orm/tables/validation.rb +12 -3
- data/lib/skyward/orm/tables/values.rb +124 -14
- data/lib/skyward/orm/tables.rb +2 -1
- data/lib/skyward/orm/transactional.rb +2 -2
- data/lib/skyward/orm/version.rb +1 -1
- data/lib/skyward/orm.rb +52 -17
- data/sig/generated/skyward/orm/adapters/postgresql/connection.rbs +35 -3
- data/sig/generated/skyward/orm/adapters/postgresql.rbs +64 -14
- data/sig/generated/skyward/orm/adapters/sqlite/connection.rbs +55 -0
- data/sig/generated/skyward/orm/adapters/sqlite/constraints.rbs +6 -0
- data/sig/generated/skyward/orm/adapters/sqlite.rbs +72 -7
- data/sig/generated/skyward/orm/adapters/statement_cache.rbs +37 -0
- data/sig/generated/skyward/orm/adapters.rbs +6 -0
- data/sig/generated/skyward/orm/catalog/column.rbs +6 -4
- data/sig/generated/skyward/orm/cli/boot_file.rbs +4 -4
- data/sig/generated/skyward/orm/cli/migrate.rbs +2 -2
- data/sig/generated/skyward/orm/cli/migration.rbs +2 -2
- data/sig/generated/skyward/orm/cli/scaffold/source.rbs +158 -0
- data/sig/generated/skyward/orm/cli/scaffold.rbs +28 -0
- data/sig/generated/skyward/orm/cli/status.rbs +2 -2
- data/sig/generated/skyward/orm/connection/instrumented.rbs +47 -0
- data/sig/generated/skyward/orm/connection/session.rbs +40 -6
- data/sig/generated/skyward/orm/database/decoders.rbs +19 -0
- data/sig/generated/skyward/orm/{connection/database → database}/schema_check.rbs +11 -4
- data/sig/generated/skyward/orm/{connection/database.rbs → database.rbs} +40 -17
- data/sig/generated/skyward/orm/execution.rbs +18 -0
- data/sig/generated/skyward/orm/migrations/alter_table.rbs +11 -5
- data/sig/generated/skyward/orm/migrations/definitions.rbs +2 -2
- data/sig/generated/skyward/orm/migrations/diff.rbs +77 -11
- data/sig/generated/skyward/orm/migrations/rename_constraint.rbs +16 -0
- data/sig/generated/skyward/orm/migrations/runner.rbs +5 -0
- data/sig/generated/skyward/orm/migrations/script.rbs +32 -8
- data/sig/generated/skyward/orm/migrations/status.rbs +15 -2
- data/sig/generated/skyward/orm/migrations/summary.rbs +0 -1
- data/sig/generated/skyward/orm/migrations/versions.rbs +2 -2
- data/sig/generated/skyward/orm/migrations.rbs +1 -1
- data/sig/generated/skyward/orm/projection.rbs +10 -2
- data/sig/generated/skyward/orm/queries/clauses.rbs +129 -40
- data/sig/generated/skyward/orm/record.rbs +14 -7
- data/sig/generated/skyward/orm/{placeholders.rbs → statements/placeholders.rbs} +2 -2
- data/sig/generated/skyward/orm/statements.rbs +84 -8
- data/sig/generated/skyward/orm/tables/column.rbs +6 -4
- data/sig/generated/skyward/orm/tables/column_types.rbs +18 -4
- data/sig/generated/skyward/orm/tables/declarations.rbs +15 -1
- data/sig/generated/skyward/orm/{members.rbs → tables/members.rbs} +2 -2
- data/sig/generated/skyward/orm/tables/rows.rbs +1 -1
- data/sig/generated/skyward/orm/tables/sources.rbs +32 -0
- data/sig/generated/skyward/orm/tables/values.rbs +41 -1
- data/sig/generated/skyward/orm/tables.rbs +3 -1
- data/sig/generated/skyward/orm.rbs +6 -6
- data/sig/manual/pg.rbs +22 -0
- data/sig/manual/skyward/orm/cli/scaffold/source.rbs +3 -0
- data/sig/manual/skyward/orm/cli/scaffold.rbs +3 -0
- data/sig/manual/skyward/orm/database/decoders.rbs +3 -0
- data/sig/manual/skyward/orm/database/schema_check.rbs +3 -0
- data/sig/manual/skyward/orm/statements/placeholders.rbs +3 -0
- data/sig/manual/skyward/orm/tables/members.rbs +3 -0
- data/sig/manual/skyward/orm/tables/sources.rbs +3 -0
- data/sig/manual/skyward/orm.rbs +41 -8
- data/sig/manual/sqlite3.rbs +13 -2
- metadata +51 -14
- data/sig/manual/skyward/orm/connection/database/schema_check.rbs +0 -3
- data/sig/manual/skyward/orm/members.rbs +0 -3
- data/sig/manual/skyward/orm/placeholders.rbs +0 -3
|
@@ -6,6 +6,9 @@ module Skyward::ORM::Adapters::PostgreSQL
|
|
|
6
6
|
# As the catalog spells each type, which compatible? is given.
|
|
7
7
|
COMPATIBLE: Hash[Skyward::ORM::Tables::column_type, Array[String]]
|
|
8
8
|
|
|
9
|
+
# COMPATIBLE read backwards, taking the narrowest type for each.
|
|
10
|
+
COLUMN_TYPES: Hash[String, Skyward::ORM::Tables::column_type]
|
|
11
|
+
|
|
9
12
|
# The catalog puts a length or precision in parentheses.
|
|
10
13
|
MODIFIER: Regexp
|
|
11
14
|
|
|
@@ -16,8 +19,9 @@ module Skyward::ORM::Adapters::PostgreSQL
|
|
|
16
19
|
|
|
17
20
|
TRAILING_ZEROS: Regexp
|
|
18
21
|
|
|
19
|
-
# PostgreSQL reads a literal default back cast to its type, as 'normal'::text
|
|
20
|
-
# and quotes a number that isn't a plain integer or decimal,
|
|
22
|
+
# PostgreSQL reads a literal default back cast to its type, as 'normal'::text
|
|
23
|
+
# or '{}'::text[], and quotes a number that isn't a plain integer or decimal,
|
|
24
|
+
# as '-1'::integer.
|
|
21
25
|
CAST: Regexp
|
|
22
26
|
|
|
23
27
|
NUMERIC: Regexp
|
|
@@ -30,6 +34,8 @@ module Skyward::ORM::Adapters::PostgreSQL
|
|
|
30
34
|
# Each value comes back as text, and a boolean as t or f.
|
|
31
35
|
TRUE_TEXT: String
|
|
32
36
|
|
|
37
|
+
FALSE_TEXT: String
|
|
38
|
+
|
|
33
39
|
VIOLATIONS: Hash[String, Skyward::ORM::violation_kind]
|
|
34
40
|
|
|
35
41
|
CONSTRAINT_KINDS: Hash[String, Skyward::ORM::Catalog::constraint_kind]
|
|
@@ -37,6 +43,7 @@ module Skyward::ORM::Adapters::PostgreSQL
|
|
|
37
43
|
# The tables an unqualified name finds, as every query names them.
|
|
38
44
|
TABLES: String
|
|
39
45
|
|
|
46
|
+
# pg_attrdef holds a generated column's expression as if it were its default.
|
|
40
47
|
COLUMNS: String
|
|
41
48
|
|
|
42
49
|
# Leaves out the indexes primary keys and unique constraints make, as SQLite's does.
|
|
@@ -48,6 +55,9 @@ module Skyward::ORM::Adapters::PostgreSQL
|
|
|
48
55
|
# @rbs return: String
|
|
49
56
|
def driver: () -> String
|
|
50
57
|
|
|
58
|
+
# @rbs return: Symbol
|
|
59
|
+
def adapter_name: () -> Symbol
|
|
60
|
+
|
|
51
61
|
# Values are decoded from PostgreSQL's ISO text, whatever the server's
|
|
52
62
|
# defaults, and times read and written in UTC. libpq prints each notice the
|
|
53
63
|
# server sends, so only warnings and worse are sent, or `skyward migrate`
|
|
@@ -56,6 +66,12 @@ module Skyward::ORM::Adapters::PostgreSQL
|
|
|
56
66
|
# @rbs return: Skyward::ORM::_Connection
|
|
57
67
|
def connect: (String location) -> Skyward::ORM::_Connection
|
|
58
68
|
|
|
69
|
+
# A connection closes each statement it evicts with close_prepared, which pg
|
|
70
|
+
# compiles only against libpq 17 and later.
|
|
71
|
+
# @rbs connection: Module
|
|
72
|
+
# @rbs return: void
|
|
73
|
+
def require_close_prepared: (Module connection) -> void
|
|
74
|
+
|
|
59
75
|
# @rbs (String _location, Integer size) -> Integer
|
|
60
76
|
def pool_size: (String _location, Integer size) -> Integer
|
|
61
77
|
|
|
@@ -63,13 +79,17 @@ module Skyward::ORM::Adapters::PostgreSQL
|
|
|
63
79
|
# @rbs return: String
|
|
64
80
|
def placeholder: (Integer position) -> String
|
|
65
81
|
|
|
82
|
+
# The protocol counts a statement's parameters in 16 bits.
|
|
83
|
+
# @rbs return: Integer
|
|
84
|
+
def bind_limit: () -> Integer
|
|
85
|
+
|
|
66
86
|
# PostgreSQL takes an OFFSET with no LIMIT before it.
|
|
67
87
|
# @rbs return: String?
|
|
68
88
|
def unlimited: () -> String?
|
|
69
89
|
|
|
70
|
-
# @rbs
|
|
90
|
+
# @rbs column: Skyward::ORM::Tables::Column
|
|
71
91
|
# @rbs return: String?
|
|
72
|
-
def sql_type: (Skyward::ORM::Tables::
|
|
92
|
+
def sql_type: (Skyward::ORM::Tables::Column column) -> String?
|
|
73
93
|
|
|
74
94
|
# @rbs return: String?
|
|
75
95
|
def identity: () -> String?
|
|
@@ -87,27 +107,51 @@ module Skyward::ORM::Adapters::PostgreSQL
|
|
|
87
107
|
def foreign_key_violations: (Skyward::ORM::_Connection _connection) -> Array[String]
|
|
88
108
|
|
|
89
109
|
# Ending the transaction released the lock, and nothing else was set.
|
|
90
|
-
# @rbs return: String
|
|
91
|
-
def end_migration: () -> String
|
|
110
|
+
# @rbs return: String?
|
|
111
|
+
def end_migration: () -> String?
|
|
92
112
|
|
|
93
113
|
# @rbs expression: String
|
|
94
114
|
# @rbs return: String
|
|
95
115
|
def default_expression: (String expression) -> String
|
|
96
116
|
|
|
97
|
-
# @rbs
|
|
117
|
+
# @rbs default: String
|
|
118
|
+
# @rbs return: String
|
|
119
|
+
def catalog_default: (String default) -> String
|
|
120
|
+
|
|
121
|
+
# @rbs column: Skyward::ORM::Tables::Column
|
|
98
122
|
# @rbs sql_type: String
|
|
99
123
|
# @rbs return: bool
|
|
100
|
-
def compatible?: (Skyward::ORM::Tables::
|
|
124
|
+
def compatible?: (Skyward::ORM::Tables::Column column, String sql_type) -> bool
|
|
125
|
+
|
|
126
|
+
# PostgreSQL compares numeric as it is.
|
|
127
|
+
# @rbs (Skyward::ORM::Tables::column_type _type, String column) -> String
|
|
128
|
+
def comparable: (Skyward::ORM::Tables::column_type _type, String column) -> String
|
|
129
|
+
|
|
130
|
+
# @rbs sql_type: String
|
|
131
|
+
# @rbs return: Skyward::ORM::Tables::column_type?
|
|
132
|
+
def column_type: (String sql_type) -> Skyward::ORM::Tables::column_type?
|
|
101
133
|
|
|
102
134
|
# The driver sends every other value as its to_s, which PostgreSQL reads.
|
|
103
135
|
# @rbs value: untyped
|
|
104
136
|
# @rbs return: untyped
|
|
105
137
|
def encode: (untyped value) -> untyped
|
|
106
138
|
|
|
107
|
-
#
|
|
139
|
+
# The encoder quotes each item that needs it, the string NULL included. A
|
|
140
|
+
# boolean is written as PostgreSQL writes one back, so a default reads back
|
|
141
|
+
# as it was written.
|
|
142
|
+
# @rbs items: Array[untyped]
|
|
143
|
+
# @rbs return: String
|
|
144
|
+
def encode_array: (Array[untyped] items) -> String
|
|
145
|
+
|
|
146
|
+
# @rbs column: Skyward::ORM::Tables::Column
|
|
147
|
+
# @rbs value: String
|
|
148
|
+
# @rbs return: String
|
|
149
|
+
def decoding: (Skyward::ORM::Tables::Column column, String value) -> String
|
|
150
|
+
|
|
151
|
+
# @rbs column: Skyward::ORM::Tables::Column
|
|
108
152
|
# @rbs value: untyped
|
|
109
153
|
# @rbs return: untyped
|
|
110
|
-
def decode: (Skyward::ORM::Tables::
|
|
154
|
+
def decode: (Skyward::ORM::Tables::Column column, untyped value) -> untyped
|
|
111
155
|
|
|
112
156
|
# @rbs (Skyward::ORM::_Connection connection) -> Array[Skyward::ORM::Catalog::Table]
|
|
113
157
|
def tables: (Skyward::ORM::_Connection connection) -> Array[Skyward::ORM::Catalog::Table]
|
|
@@ -118,6 +162,16 @@ module Skyward::ORM::Adapters::PostgreSQL
|
|
|
118
162
|
|
|
119
163
|
private
|
|
120
164
|
|
|
165
|
+
# @rbs type: Skyward::ORM::Tables::column_type
|
|
166
|
+
# @rbs sql_type: String
|
|
167
|
+
# @rbs return: bool
|
|
168
|
+
def accepts?: (Skyward::ORM::Tables::column_type type, String sql_type) -> bool
|
|
169
|
+
|
|
170
|
+
# @rbs type: Skyward::ORM::Tables::column_type
|
|
171
|
+
# @rbs value: String
|
|
172
|
+
# @rbs return: String
|
|
173
|
+
def scalar: (Skyward::ORM::Tables::column_type type, String value) -> String
|
|
174
|
+
|
|
121
175
|
# @rbs rows: Array[Array[untyped]]
|
|
122
176
|
# @rbs return: Array[Skyward::ORM::Catalog::Index]
|
|
123
177
|
def indexes: (Array[Array[untyped]] rows) -> Array[Skyward::ORM::Catalog::Index]
|
|
@@ -126,10 +180,6 @@ module Skyward::ORM::Adapters::PostgreSQL
|
|
|
126
180
|
# @rbs return: Array[Skyward::ORM::Catalog::Constraint]
|
|
127
181
|
def constraints: (Array[Array[untyped]] rows) -> Array[Skyward::ORM::Catalog::Constraint]
|
|
128
182
|
|
|
129
|
-
# @rbs expression: String?
|
|
130
|
-
# @rbs return: String?
|
|
131
|
-
def default: (String? expression) -> String?
|
|
132
|
-
|
|
133
183
|
# @rbs tables: Array[Skyward::ORM::Catalog::Table]
|
|
134
184
|
# @rbs table: String?
|
|
135
185
|
# @rbs name: String?
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Generated from lib/skyward/orm/adapters/sqlite/connection.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# SQLite3::Database#execute prepares, runs and closes a new statement on every
|
|
4
|
+
# call, so this keeps the statements it's asked to prepare, to run again.
|
|
5
|
+
class Skyward::ORM::Adapters::SQLite::Connection
|
|
6
|
+
@database: SQLite3::Database[SQLite3::result_as_array]
|
|
7
|
+
|
|
8
|
+
@statements: Skyward::ORM::Adapters::StatementCache[SQLite3::Statement]
|
|
9
|
+
|
|
10
|
+
# @rbs database: SQLite3::Database[SQLite3::result_as_array]
|
|
11
|
+
# @rbs statements: Skyward::ORM::Adapters::StatementCache[SQLite3::Statement]
|
|
12
|
+
# @rbs return: void
|
|
13
|
+
def initialize: (SQLite3::Database[SQLite3::result_as_array] database, Skyward::ORM::Adapters::StatementCache[SQLite3::Statement] statements) -> void
|
|
14
|
+
|
|
15
|
+
# @rbs sql: String
|
|
16
|
+
# @rbs binds: Array[untyped]
|
|
17
|
+
# @rbs prepare: bool
|
|
18
|
+
# @rbs return: Array[Array[untyped]]
|
|
19
|
+
def execute: (String sql, ?Array[untyped] binds, ?prepare: bool) -> Array[Array[untyped]]
|
|
20
|
+
|
|
21
|
+
# @rbs sql: String
|
|
22
|
+
# @rbs *binds: untyped
|
|
23
|
+
# @rbs prepare: bool
|
|
24
|
+
# @rbs return: Array[Array[untyped]]
|
|
25
|
+
def execute2: (String sql, *untyped binds, ?prepare: bool) -> Array[Array[untyped]]
|
|
26
|
+
|
|
27
|
+
# @rbs sql: String
|
|
28
|
+
# @rbs return: void
|
|
29
|
+
def execute_batch: (String sql) -> void
|
|
30
|
+
|
|
31
|
+
# @rbs return: Integer
|
|
32
|
+
def changes: () -> Integer
|
|
33
|
+
|
|
34
|
+
# @rbs return: bool
|
|
35
|
+
def transaction_active?: () -> bool
|
|
36
|
+
|
|
37
|
+
# SQLite holds a closed database open until each of its statements is closed too.
|
|
38
|
+
# @rbs return: void
|
|
39
|
+
def close: () -> void
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
|
|
43
|
+
# @rbs sql: String
|
|
44
|
+
# @rbs binds: Array[untyped]
|
|
45
|
+
# @rbs prepare: bool
|
|
46
|
+
# @rbs return: SQLite3::Statement?
|
|
47
|
+
def kept: (String sql, Array[untyped] binds, bool prepare) -> SQLite3::Statement?
|
|
48
|
+
|
|
49
|
+
# Reset however it ends, so no kept statement is left running, where it would
|
|
50
|
+
# stop a migration's DROP TABLE with "database table is locked".
|
|
51
|
+
# @rbs statement: SQLite3::Statement
|
|
52
|
+
# @rbs binds: Array[untyped]
|
|
53
|
+
# @rbs return: Array[Array[untyped]]
|
|
54
|
+
def run: (SQLite3::Statement statement, Array[untyped] binds) -> Array[Array[untyped]]
|
|
55
|
+
end
|
|
@@ -26,6 +26,12 @@ module Skyward::ORM::Adapters::SQLite::Constraints
|
|
|
26
26
|
# @rbs return: Array[Skyward::ORM::Catalog::Constraint]
|
|
27
27
|
def read: (String sql, Array[Symbol] columns) -> Array[Skyward::ORM::Catalog::Constraint]
|
|
28
28
|
|
|
29
|
+
# SQLite's grammar makes GENERATED ALWAYS AS a column constraint, and
|
|
30
|
+
# table_xinfo doesn't give its expression, so that's read from here too.
|
|
31
|
+
# @rbs sql: String
|
|
32
|
+
# @rbs return: Hash[Symbol, String]
|
|
33
|
+
def generated: (String sql) -> Hash[Symbol, String]
|
|
34
|
+
|
|
29
35
|
private
|
|
30
36
|
|
|
31
37
|
# The scan covers every character, since its last alternative matches any
|
|
@@ -21,10 +21,27 @@ module Skyward::ORM::Adapters::SQLite
|
|
|
21
21
|
|
|
22
22
|
RESTRICTED: String
|
|
23
23
|
|
|
24
|
+
# Types whose values keep their meaning under NUMERIC affinity, which Rails
|
|
25
|
+
# gives BOOLEAN, DATE and DATETIME. A boolean is already a number, and a date
|
|
26
|
+
# or time is never a well-formed number, so none is converted. A String or a
|
|
27
|
+
# BigDecimal would be: NUMERIC turns "1.10" into 1.1.
|
|
28
|
+
NUMERIC_SAFE: Array[Skyward::ORM::Tables::column_type]
|
|
29
|
+
|
|
30
|
+
# The names Rails writes for the NUMERIC_SAFE types, with any precision, as
|
|
31
|
+
# in DATETIME(6). Nothing else in the catalog tells a bool, Date or Time from
|
|
32
|
+
# an Integer or String, since a migration stores them as INTEGER and TEXT.
|
|
33
|
+
NUMERIC_NAMES: Hash[String, Skyward::ORM::Tables::column_type]
|
|
34
|
+
|
|
35
|
+
PRECISION: Regexp
|
|
36
|
+
|
|
37
|
+
AFFINITY_TYPES: Hash[Symbol, Skyward::ORM::Tables::column_type]
|
|
38
|
+
|
|
24
39
|
UNIQUE_KINDS: Array[Skyward::ORM::Catalog::constraint_kind]
|
|
25
40
|
|
|
26
41
|
BUSY_TIMEOUT_MS: Integer
|
|
27
42
|
|
|
43
|
+
# table_info leaves out generated columns, which table_xinfo marks hidden 2
|
|
44
|
+
# (virtual) or 3 (stored). Hidden 1 is a virtual table's own hidden column.
|
|
28
45
|
COLUMNS: String
|
|
29
46
|
|
|
30
47
|
INDEXES: String
|
|
@@ -36,6 +53,9 @@ module Skyward::ORM::Adapters::SQLite
|
|
|
36
53
|
# @rbs return: String
|
|
37
54
|
def driver: () -> String
|
|
38
55
|
|
|
56
|
+
# @rbs return: Symbol
|
|
57
|
+
def adapter_name: () -> Symbol
|
|
58
|
+
|
|
39
59
|
# @rbs location: String
|
|
40
60
|
# @rbs return: Skyward::ORM::_Connection
|
|
41
61
|
def connect: (String location) -> Skyward::ORM::_Connection
|
|
@@ -54,13 +74,19 @@ module Skyward::ORM::Adapters::SQLite
|
|
|
54
74
|
# @rbs (Integer _position) -> String
|
|
55
75
|
def placeholder: (Integer _position) -> String
|
|
56
76
|
|
|
77
|
+
# SQLITE_MAX_VARIABLE_NUMBER's default since 3.32. A SQLite built with a
|
|
78
|
+
# lower one refuses with its own error, since the sqlite3 gem doesn't expose
|
|
79
|
+
# sqlite3_limit to read it.
|
|
80
|
+
# @rbs return: Integer
|
|
81
|
+
def bind_limit: () -> Integer
|
|
82
|
+
|
|
57
83
|
# SQLite takes an OFFSET only after a LIMIT, and a negative one is no limit.
|
|
58
84
|
# @rbs return: String
|
|
59
85
|
def unlimited: () -> String
|
|
60
86
|
|
|
61
|
-
# @rbs
|
|
87
|
+
# @rbs column: Skyward::ORM::Tables::Column
|
|
62
88
|
# @rbs return: String?
|
|
63
|
-
def sql_type: (Skyward::ORM::Tables::
|
|
89
|
+
def sql_type: (Skyward::ORM::Tables::Column column) -> String?
|
|
64
90
|
|
|
65
91
|
# An INTEGER PRIMARY KEY is SQLite's rowid, which numbers rows on its own.
|
|
66
92
|
# @rbs return: String?
|
|
@@ -76,21 +102,49 @@ module Skyward::ORM::Adapters::SQLite
|
|
|
76
102
|
# @rbs return: String
|
|
77
103
|
def default_expression: (String expression) -> String
|
|
78
104
|
|
|
105
|
+
# The catalog puts back the parentheses SQLite drops, so it reads a default
|
|
106
|
+
# back as it was written.
|
|
107
|
+
# @rbs default: String
|
|
108
|
+
# @rbs return: String
|
|
109
|
+
def catalog_default: (String default) -> String
|
|
110
|
+
|
|
79
111
|
# SQLite stores a value by its column's affinity, which it reads from the
|
|
80
|
-
# declared type, so any declared type with the same affinity is compatible
|
|
81
|
-
#
|
|
112
|
+
# declared type, so any declared type with the same affinity is compatible,
|
|
113
|
+
# and for NUMERIC_SAFE types, NUMERIC as well.
|
|
114
|
+
# @rbs column: Skyward::ORM::Tables::Column
|
|
82
115
|
# @rbs sql_type: String
|
|
83
116
|
# @rbs return: bool
|
|
84
|
-
def compatible?: (Skyward::ORM::Tables::
|
|
117
|
+
def compatible?: (Skyward::ORM::Tables::Column column, String sql_type) -> bool
|
|
118
|
+
|
|
119
|
+
# A decimal's text orders "10.5" before "9.0", so a range or an order
|
|
120
|
+
# compares it as a REAL, which is exact to 15 significant digits.
|
|
121
|
+
# @rbs type: Skyward::ORM::Tables::column_type
|
|
122
|
+
# @rbs column: String
|
|
123
|
+
# @rbs return: String
|
|
124
|
+
def comparable: (Skyward::ORM::Tables::column_type type, String column) -> String
|
|
125
|
+
|
|
126
|
+
# @rbs sql_type: String
|
|
127
|
+
# @rbs return: Skyward::ORM::Tables::column_type?
|
|
128
|
+
def column_type: (String sql_type) -> Skyward::ORM::Tables::column_type?
|
|
85
129
|
|
|
86
130
|
# @rbs value: untyped
|
|
87
131
|
# @rbs return: untyped
|
|
88
132
|
def encode: (untyped value) -> untyped
|
|
89
133
|
|
|
90
|
-
#
|
|
134
|
+
# JSON holds a boolean as one, where a column holds it as 0 or 1.
|
|
135
|
+
# @rbs items: Array[untyped]
|
|
136
|
+
# @rbs return: String
|
|
137
|
+
def encode_array: (Array[untyped] items) -> String
|
|
138
|
+
|
|
139
|
+
# @rbs column: Skyward::ORM::Tables::Column
|
|
140
|
+
# @rbs value: String
|
|
141
|
+
# @rbs return: String
|
|
142
|
+
def decoding: (Skyward::ORM::Tables::Column column, String value) -> String
|
|
143
|
+
|
|
144
|
+
# @rbs column: Skyward::ORM::Tables::Column
|
|
91
145
|
# @rbs value: untyped
|
|
92
146
|
# @rbs return: untyped
|
|
93
|
-
def decode: (Skyward::ORM::Tables::
|
|
147
|
+
def decode: (Skyward::ORM::Tables::Column column, untyped value) -> untyped
|
|
94
148
|
|
|
95
149
|
# @rbs (Skyward::ORM::_Connection connection) -> Array[Skyward::ORM::Catalog::Table]
|
|
96
150
|
def tables: (Skyward::ORM::_Connection connection) -> Array[Skyward::ORM::Catalog::Table]
|
|
@@ -121,6 +175,17 @@ module Skyward::ORM::Adapters::SQLite
|
|
|
121
175
|
|
|
122
176
|
private
|
|
123
177
|
|
|
178
|
+
# @rbs type: Skyward::ORM::Tables::column_type
|
|
179
|
+
# @rbs value: String
|
|
180
|
+
# @rbs return: String
|
|
181
|
+
def scalar: (Skyward::ORM::Tables::column_type type, String value) -> String
|
|
182
|
+
|
|
183
|
+
# An Array[Float]'s JSON may hold an Integer, as an Array[Float] takes one.
|
|
184
|
+
# @rbs type: Skyward::ORM::Tables::column_type
|
|
185
|
+
# @rbs value: String
|
|
186
|
+
# @rbs return: String
|
|
187
|
+
def item: (Skyward::ORM::Tables::column_type type, String value) -> String
|
|
188
|
+
|
|
124
189
|
# @rbs sql_type: String
|
|
125
190
|
# @rbs return: Symbol
|
|
126
191
|
def affinity: (String sql_type) -> Symbol
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Generated from lib/skyward/orm/adapters/statement_cache.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# Only one fiber uses a connection at a time, so its cache takes no lock.
|
|
4
|
+
# @rbs generic S
|
|
5
|
+
class Skyward::ORM::Adapters::StatementCache[S]
|
|
6
|
+
LIMIT: Integer
|
|
7
|
+
|
|
8
|
+
# A statement with more binds isn't kept. Varying IN lists and multi-row
|
|
9
|
+
# inserts are what reach it: each length is different SQL that would churn
|
|
10
|
+
# the cache, PostgreSQL keeps a large plan for each, and parsing is a small
|
|
11
|
+
# part of their cost.
|
|
12
|
+
MAX_BINDS: Integer
|
|
13
|
+
|
|
14
|
+
@limit: Integer
|
|
15
|
+
|
|
16
|
+
@statements: Hash[String, S]
|
|
17
|
+
|
|
18
|
+
# @rbs limit: Integer
|
|
19
|
+
# @rbs return: void
|
|
20
|
+
def initialize: (?Integer limit) -> void
|
|
21
|
+
|
|
22
|
+
# @rbs binds: Array[untyped]
|
|
23
|
+
# @rbs return: bool
|
|
24
|
+
def keeps?: (Array[untyped] binds) -> bool
|
|
25
|
+
|
|
26
|
+
# @rbs sql: String
|
|
27
|
+
# @rbs return: S?
|
|
28
|
+
def fetch: (String sql) -> S?
|
|
29
|
+
|
|
30
|
+
# @rbs sql: String
|
|
31
|
+
# @rbs statement: S
|
|
32
|
+
# @rbs return: S?
|
|
33
|
+
def store: (String sql, S statement) -> S?
|
|
34
|
+
|
|
35
|
+
# @rbs return: Array[S]
|
|
36
|
+
def clear: () -> Array[S]
|
|
37
|
+
end
|
|
@@ -3,10 +3,16 @@
|
|
|
3
3
|
module Skyward::ORM::Adapters
|
|
4
4
|
SCHEMES: Hash[String, Skyward::ORM::_Adapter]
|
|
5
5
|
|
|
6
|
+
# What comes before "://" is shown only when it's a scheme: in a malformed URL it can hold a password.
|
|
7
|
+
SCHEME: Regexp
|
|
8
|
+
|
|
6
9
|
# @rbs (String url, schemes: Hash[String, Skyward::ORM::_Adapter], requirer: ^(String) -> void)
|
|
7
10
|
# -> [Skyward::ORM::_Adapter, String]
|
|
8
11
|
def resolve: (String url, schemes: Hash[String, Skyward::ORM::_Adapter], requirer: ^(String) -> void) -> [ Skyward::ORM::_Adapter, String ]
|
|
9
12
|
|
|
13
|
+
# @rbs (Skyward::ORM::_Adapter adapter, Skyward::ORM::Tables::Column column, untyped value) -> untyped
|
|
14
|
+
def decode: (Skyward::ORM::_Adapter adapter, Skyward::ORM::Tables::Column column, untyped value) -> untyped
|
|
15
|
+
|
|
10
16
|
private
|
|
11
17
|
|
|
12
18
|
# The URL can hold a password, so only its scheme is shown.
|
|
@@ -10,11 +10,13 @@ module Skyward::ORM::Catalog
|
|
|
10
10
|
|
|
11
11
|
attr_reader default(): String?
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
| (name: Symbol, type: String, nullable: bool, default: String?) -> instance
|
|
13
|
+
attr_reader generated(): String?
|
|
15
14
|
|
|
16
|
-
def self.
|
|
15
|
+
def self.new: (Symbol name, String type, bool nullable, String? default, String? generated) -> instance
|
|
16
|
+
| (name: Symbol, type: String, nullable: bool, default: String?, generated: String?) -> instance
|
|
17
17
|
|
|
18
|
-
def members: () -> [ :name, :type, :nullable, :default ]
|
|
18
|
+
def self.members: () -> [ :name, :type, :nullable, :default, :generated ]
|
|
19
|
+
|
|
20
|
+
def members: () -> [ :name, :type, :nullable, :default, :generated ]
|
|
19
21
|
end
|
|
20
22
|
end
|
|
@@ -6,8 +6,8 @@ module Skyward::ORM::CLI::BootFile
|
|
|
6
6
|
# @rbs directory: String
|
|
7
7
|
# @rbs session: Skyward::ORM::Connection::Session
|
|
8
8
|
# @rbs generate: ^() -> String?
|
|
9
|
-
# @rbs return: Skyward::ORM::
|
|
10
|
-
def load: (String directory, Skyward::ORM::Connection::Session session, ^() -> String? generate) -> (Skyward::ORM::
|
|
9
|
+
# @rbs return: Skyward::ORM::Database | String
|
|
10
|
+
def load: (String directory, Skyward::ORM::Connection::Session session, ^() -> String? generate) -> (Skyward::ORM::Database | String)
|
|
11
11
|
|
|
12
12
|
# The migration commands are what fixes a schema that doesn't match, so they
|
|
13
13
|
# boot the app with the check off.
|
|
@@ -15,7 +15,7 @@ module Skyward::ORM::CLI::BootFile
|
|
|
15
15
|
# @rbs session: Skyward::ORM::Connection::Session
|
|
16
16
|
# @rbs kernel: singleton(Kernel)
|
|
17
17
|
# @rbs generate: ^() -> String?
|
|
18
|
-
# @rbs &: (Skyward::ORM::
|
|
18
|
+
# @rbs &: (Skyward::ORM::Database) -> void
|
|
19
19
|
# @rbs return: void
|
|
20
|
-
def boot: (String directory, Skyward::ORM::Connection::Session session, singleton(Kernel) kernel, ^() -> String? generate) { (Skyward::ORM::
|
|
20
|
+
def boot: (String directory, Skyward::ORM::Connection::Session session, singleton(Kernel) kernel, ^() -> String? generate) { (Skyward::ORM::Database) -> void } -> void
|
|
21
21
|
end
|
|
@@ -9,7 +9,7 @@ module Skyward::ORM::CLI::Migrate
|
|
|
9
9
|
|
|
10
10
|
private
|
|
11
11
|
|
|
12
|
-
# @rbs (Skyward::ORM::
|
|
12
|
+
# @rbs (Skyward::ORM::Database database, directory: String, out: _Writer, kernel: singleton(Kernel),
|
|
13
13
|
# discover: ^() -> Array[singleton(Skyward::ORM::Record)]) -> void
|
|
14
|
-
def migrate: (Skyward::ORM::
|
|
14
|
+
def migrate: (Skyward::ORM::Database database, directory: String, out: _Writer, kernel: singleton(Kernel), discover: ^() -> Array[singleton(Skyward::ORM::Record)]) -> void
|
|
15
15
|
end
|
|
@@ -25,9 +25,9 @@ module Skyward::ORM::CLI::Migration
|
|
|
25
25
|
# change twice, so a pending one stops it. With no terminal to ask whether a
|
|
26
26
|
# column was renamed, it stops rather than guess, since a guess of no drops
|
|
27
27
|
# the column's data.
|
|
28
|
-
# @rbs (String name, Skyward::ORM::
|
|
28
|
+
# @rbs (String name, Skyward::ORM::Database database, directory: String, time: Time, input: IO,
|
|
29
29
|
# out: _Writer, kernel: singleton(Kernel), discover: ^() -> Array[singleton(Skyward::ORM::Record)]) -> void
|
|
30
|
-
def write: (String name, Skyward::ORM::
|
|
30
|
+
def write: (String name, Skyward::ORM::Database database, directory: String, time: Time, input: IO, out: _Writer, kernel: singleton(Kernel), discover: ^() -> Array[singleton(Skyward::ORM::Record)]) -> void
|
|
31
31
|
|
|
32
32
|
# @rbs input: IO
|
|
33
33
|
# @rbs out: _Writer
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Generated from lib/skyward/orm/cli/scaffold/source.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# A table class's file, written from its table as the catalog reads it. Each
|
|
4
|
+
# type, default and constraint is one the class's migration would write the
|
|
5
|
+
# same, so `skyward migration` changes only what a comment says it will.
|
|
6
|
+
module Skyward::ORM::CLI::Scaffold::Source
|
|
7
|
+
# Only a trailing s is dropped: ies becomes y, sses becomes ss, and ss stays.
|
|
8
|
+
SINGULAR: Regexp
|
|
9
|
+
|
|
10
|
+
SINGULARS: Hash[String, String]
|
|
11
|
+
|
|
12
|
+
QUOTED: Regexp
|
|
13
|
+
|
|
14
|
+
LITERAL: Regexp
|
|
15
|
+
|
|
16
|
+
ISO_DATE: Regexp
|
|
17
|
+
|
|
18
|
+
# A Time as SQLite's adapter decodes it, to the microsecond. PostgreSQL reads
|
|
19
|
+
# a default back with a cast, so no Time is written back the same there.
|
|
20
|
+
ISO_TIME: Regexp
|
|
21
|
+
|
|
22
|
+
BOOLS: Hash[String, bool]
|
|
23
|
+
|
|
24
|
+
ENUM: Skyward::ORM::Tables::Column
|
|
25
|
+
|
|
26
|
+
PARENTHESIZED: Regexp
|
|
27
|
+
|
|
28
|
+
CHECK: Regexp
|
|
29
|
+
|
|
30
|
+
# What's left of a check that lists a column's values once its strings,
|
|
31
|
+
# casts and punctuation are gone. SQLite keeps `priority IN ('low', 'high')`,
|
|
32
|
+
# and PostgreSQL rewrites it as `priority = ANY (ARRAY['low'::text, 'high'::text])`.
|
|
33
|
+
CAST: Regexp
|
|
34
|
+
|
|
35
|
+
PUNCTUATION: Regexp
|
|
36
|
+
|
|
37
|
+
LISTS: Array[String]
|
|
38
|
+
|
|
39
|
+
# A btree index on columns alone, as PostgreSQL writes one back, or as it was written on SQLite.
|
|
40
|
+
PLAIN_INDEX: Regexp
|
|
41
|
+
|
|
42
|
+
# The columns a foreign key names after the table it references, if it names any.
|
|
43
|
+
REFERENCED: Regexp
|
|
44
|
+
|
|
45
|
+
DROPPED: String
|
|
46
|
+
|
|
47
|
+
REWRITTEN: String
|
|
48
|
+
|
|
49
|
+
# @rbs (Skyward::ORM::Catalog::Table table, Array[Skyward::ORM::Catalog::Table] tables,
|
|
50
|
+
# Skyward::ORM::_Adapter adapter, Array[singleton(Skyward::ORM::Record)] classes) -> String
|
|
51
|
+
def text: (Skyward::ORM::Catalog::Table table, Array[Skyward::ORM::Catalog::Table] tables, Skyward::ORM::_Adapter adapter, Array[singleton(Skyward::ORM::Record)] classes) -> String
|
|
52
|
+
|
|
53
|
+
# @rbs table: Symbol
|
|
54
|
+
# @rbs return: String
|
|
55
|
+
def class_name: (Symbol table) -> String
|
|
56
|
+
|
|
57
|
+
# @rbs table: Skyward::ORM::Catalog::Table?
|
|
58
|
+
# @rbs return: Array[Symbol]
|
|
59
|
+
def primary_key: (Skyward::ORM::Catalog::Table? table) -> Array[Symbol]
|
|
60
|
+
|
|
61
|
+
private
|
|
62
|
+
|
|
63
|
+
# Each line below `table`, in the README's order, with what the class can't
|
|
64
|
+
# declare first, as a comment.
|
|
65
|
+
# @rbs (Skyward::ORM::Catalog::Table table, Array[Skyward::ORM::Catalog::Table] tables,
|
|
66
|
+
# Skyward::ORM::_Adapter adapter, Array[singleton(Skyward::ORM::Record)] classes,
|
|
67
|
+
# Array[Skyward::ORM::Catalog::Constraint] checks, Hash[Symbol, Skyward::ORM::Tables::column_type?] types)
|
|
68
|
+
# -> Array[String]
|
|
69
|
+
def declarations: (Skyward::ORM::Catalog::Table table, Array[Skyward::ORM::Catalog::Table] tables, Skyward::ORM::_Adapter adapter, Array[singleton(Skyward::ORM::Record)] classes, Array[Skyward::ORM::Catalog::Constraint] checks, Hash[Symbol, Skyward::ORM::Tables::column_type?] types) -> Array[String]
|
|
70
|
+
|
|
71
|
+
# @rbs columns: Array[Skyward::ORM::Catalog::Column]
|
|
72
|
+
# @rbs unions: Hash[Symbol, [Skyward::ORM::Catalog::Constraint, Array[Symbol]]]
|
|
73
|
+
# @rbs types: Hash[Symbol, Skyward::ORM::Tables::column_type?]
|
|
74
|
+
# @rbs return: Array[String]
|
|
75
|
+
def readers: (Array[Skyward::ORM::Catalog::Column] columns, Hash[Symbol, [ Skyward::ORM::Catalog::Constraint, Array[Symbol] ]] unions, Hash[Symbol, Skyward::ORM::Tables::column_type?] types) -> Array[String]
|
|
76
|
+
|
|
77
|
+
# A text column whose check lists only strings is a symbol union, and its
|
|
78
|
+
# type makes that check.
|
|
79
|
+
# @rbs (Skyward::ORM::Catalog::Column column, Array[Skyward::ORM::Catalog::Constraint] checks,
|
|
80
|
+
# Skyward::ORM::_Adapter adapter) -> [Skyward::ORM::Catalog::Constraint, Array[Symbol]]?
|
|
81
|
+
def union: (Skyward::ORM::Catalog::Column column, Array[Skyward::ORM::Catalog::Constraint] checks, Skyward::ORM::_Adapter adapter) -> [ Skyward::ORM::Catalog::Constraint, Array[Symbol] ]?
|
|
82
|
+
|
|
83
|
+
# A literal the column's type reads is that value, if it's written back the
|
|
84
|
+
# same. Anything else is SQL, without the parentheses SQLite's adapter puts
|
|
85
|
+
# back, since its default_expression adds them again. The bool says whether
|
|
86
|
+
# it's written back the same. SQLite keeps a literal as it was written, even
|
|
87
|
+
# in parentheses, so one no value writes back the same, such as 1.50, is the
|
|
88
|
+
# value it reads as, which a migration rewrites it as once, or nil when it
|
|
89
|
+
# reads as none.
|
|
90
|
+
# @rbs (Skyward::ORM::Catalog::Column column, Skyward::ORM::Tables::column_type? type,
|
|
91
|
+
# Skyward::ORM::_Adapter adapter) -> [Skyward::ORM::Catalog::Column, String?, bool]?
|
|
92
|
+
def default: (Skyward::ORM::Catalog::Column column, Skyward::ORM::Tables::column_type? type, Skyward::ORM::_Adapter adapter) -> [ Skyward::ORM::Catalog::Column, String?, bool ]?
|
|
93
|
+
|
|
94
|
+
# @rbs sql: String
|
|
95
|
+
# @rbs type: Skyward::ORM::Tables::column_type?
|
|
96
|
+
# @rbs return: Array[untyped]
|
|
97
|
+
def values: (String sql, Skyward::ORM::Tables::column_type? type) -> Array[untyped]
|
|
98
|
+
|
|
99
|
+
# @rbs string: String?
|
|
100
|
+
# @rbs return: Date?
|
|
101
|
+
def date: (String? string) -> Date?
|
|
102
|
+
|
|
103
|
+
# @rbs string: String?
|
|
104
|
+
# @rbs return: Time?
|
|
105
|
+
def time: (String? string) -> Time?
|
|
106
|
+
|
|
107
|
+
# @rbs value: untyped
|
|
108
|
+
# @rbs return: String
|
|
109
|
+
def ruby: (untyped value) -> String
|
|
110
|
+
|
|
111
|
+
# Ruby source for a value in the shared style: a String or a quoted Symbol in
|
|
112
|
+
# single quotes, unless it holds a quote, a backslash or a character only an
|
|
113
|
+
# escape can write, which double quotes are for.
|
|
114
|
+
# @rbs value: untyped
|
|
115
|
+
# @rbs return: String
|
|
116
|
+
def literal: (untyped value) -> String
|
|
117
|
+
|
|
118
|
+
# @rbs text: String
|
|
119
|
+
# @rbs return: bool
|
|
120
|
+
def single_quotable?: (String text) -> bool
|
|
121
|
+
|
|
122
|
+
# A foreign key a class declares is on one column, and refers to the
|
|
123
|
+
# primary key of the table it references.
|
|
124
|
+
# @rbs constraint: Skyward::ORM::Catalog::Constraint
|
|
125
|
+
# @rbs tables: Array[Skyward::ORM::Catalog::Table]
|
|
126
|
+
# @rbs return: bool
|
|
127
|
+
def reference?: (Skyward::ORM::Catalog::Constraint constraint, Array[Skyward::ORM::Catalog::Table] tables) -> bool
|
|
128
|
+
|
|
129
|
+
# @rbs table: Symbol
|
|
130
|
+
# @rbs constraint: Skyward::ORM::Catalog::Constraint
|
|
131
|
+
# @rbs classes: Array[singleton(Skyward::ORM::Record)]
|
|
132
|
+
# @rbs return: Array[String]
|
|
133
|
+
def reference: (Symbol table, Skyward::ORM::Catalog::Constraint constraint, Array[singleton(Skyward::ORM::Record)] classes) -> Array[String]
|
|
134
|
+
|
|
135
|
+
# @rbs index: Skyward::ORM::Catalog::Index
|
|
136
|
+
# @rbs return: bool
|
|
137
|
+
def plain?: (Skyward::ORM::Catalog::Index index) -> bool
|
|
138
|
+
|
|
139
|
+
# @rbs check: Skyward::ORM::Catalog::Constraint
|
|
140
|
+
# @rbs return: String
|
|
141
|
+
def rule: (Skyward::ORM::Catalog::Constraint check) -> String
|
|
142
|
+
|
|
143
|
+
# @rbs declaration: String
|
|
144
|
+
# @rbs key: Skyward::ORM::Catalog::Constraint | Skyward::ORM::Catalog::Index
|
|
145
|
+
# @rbs return: String
|
|
146
|
+
def columns: (String declaration, Skyward::ORM::Catalog::Constraint | Skyward::ORM::Catalog::Index key) -> String
|
|
147
|
+
|
|
148
|
+
# Every line of the text is commented, since a definition or name the
|
|
149
|
+
# database keeps can hold a newline.
|
|
150
|
+
# @rbs text: String
|
|
151
|
+
# @rbs prefix: String
|
|
152
|
+
# @rbs return: String
|
|
153
|
+
def comment: (String text, ?String prefix) -> String
|
|
154
|
+
|
|
155
|
+
# @rbs undeclarable: Skyward::ORM::Catalog::Column | Skyward::ORM::Catalog::Constraint | Skyward::ORM::Catalog::Index
|
|
156
|
+
# @rbs return: String
|
|
157
|
+
def definition: (Skyward::ORM::Catalog::Column | Skyward::ORM::Catalog::Constraint | Skyward::ORM::Catalog::Index undeclarable) -> String
|
|
158
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Generated from lib/skyward/orm/cli/scaffold.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Skyward::ORM::CLI::Scaffold
|
|
4
|
+
USAGE: String
|
|
5
|
+
|
|
6
|
+
# A row compiles @name for each column, and has these methods of its own.
|
|
7
|
+
COLUMN: Regexp
|
|
8
|
+
|
|
9
|
+
TAKEN: Array[Symbol]
|
|
10
|
+
|
|
11
|
+
# @rbs (Array[String] args, directory: String, out: _Writer, kernel: singleton(Kernel),
|
|
12
|
+
# session: Skyward::ORM::Connection::Session, discover: ^() -> Array[singleton(Skyward::ORM::Record)],
|
|
13
|
+
# generate: ^() -> String?) -> void
|
|
14
|
+
def run: (Array[String] args, directory: String, out: _Writer, kernel: singleton(Kernel), session: Skyward::ORM::Connection::Session, discover: ^() -> Array[singleton(Skyward::ORM::Record)], generate: ^() -> String?) -> void
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
# @rbs name: String
|
|
19
|
+
# @rbs tables: Array[Skyward::ORM::Catalog::Table]
|
|
20
|
+
# @rbs classes: Array[singleton(Skyward::ORM::Record)]
|
|
21
|
+
# @rbs return: Skyward::ORM::Catalog::Table | String
|
|
22
|
+
def find: (String name, Array[Skyward::ORM::Catalog::Table] tables, Array[singleton(Skyward::ORM::Record)] classes) -> (Skyward::ORM::Catalog::Table | String)
|
|
23
|
+
|
|
24
|
+
# @rbs table: Skyward::ORM::Catalog::Table
|
|
25
|
+
# @rbs classes: Array[singleton(Skyward::ORM::Record)]
|
|
26
|
+
# @rbs return: String?
|
|
27
|
+
def refusal: (Skyward::ORM::Catalog::Table table, Array[singleton(Skyward::ORM::Record)] classes) -> String?
|
|
28
|
+
end
|