-
Notifications
You must be signed in to change notification settings - Fork 41
/
lhm.rbi
206 lines (154 loc) · 5.04 KB
/
lhm.rbi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# typed: strong
module Lhm
extend Lhm
extend Lhm::Throttler
sig { returns(Lhm::Connection) }
def adapter; end
sig do
params(
table_name: T.any(String, Symbol),
options: T::Hash[Symbol, T.untyped],
block: T.proc.params(arg0: Lhm::Migrator).void
).returns(TrueClass)
end
def change_table(table_name, options = nil, &block); end
sig { params(run: T.nilable(T::Boolean), options: T.nilable(T::Hash[Symbol, T.untyped])).returns(T::Boolean) }
def cleanup(run = nil, options = nil); end
sig { returns(Lhm::Connection) }
def connection; end
sig { returns(Logger) }
def self.logger; end
sig { params(new_logger: Logger).returns(Logger) }
def self.logger=(new_logger); end
sig { params(adapter: Lhm::Connection).returns(Lhm::Connection) }
def setup(adapter); end
end
class Lhm::Table
sig { params(name: T.any(String, Symbol), pk: T.nilable(T.any(String, Symbol)), ddl: T.untyped).void }
def initialize(name, pk = nil, ddl = nil); end
sig { returns(T::Hash[T.untyped, T.untyped]) }
def columns; end
sig { returns(T.untyped) }
def ddl; end
sig { returns(String) }
def destination_name; end
sig { returns(T::Hash[T.untyped, T.untyped]) }
def indices; end
sig { returns(T.any(String, Symbol)) }
def name; end
sig { returns(T.any(String, Symbol)) }
def pk; end
sig { returns(T.nilable(T::Boolean)) }
def satisfies_primary_key?; end
sig { params(table_name: T.any(Symbol, String), connection: Lhm::Connection).returns(Lhm::Table) }
def self.parse(table_name, connection); end
end
module Lhm::Command
sig { params(block: T.nilable(T.proc.params(arg0: Lhm::Command).void)).void }
def run(&block); end
end
class Lhm::Printer::Output
sig { params(message: String).void }
def write(message); end
end
class Lhm::Printer::Base
sig { void }
def initialize; end
end
class Lhm::Printer::Percentage < Lhm::Printer::Base
sig { void }
def initialize; end
sig { void }
def end; end
sig { params(lowest: Numeric, highest: T.nilable(Numeric)).void }
def notify(lowest, highest); end
end
class Lhm::Printer::Dot < Lhm::Printer::Base
sig { void }
def end; end
sig { params(lowest: T.nilable(Numeric), highest: T.nilable(Numeric)).void }
def notify(lowest = nil, highest = nil); end
end
class Lhm::Migrator
include Lhm::Command
include Lhm::SqlHelper
sig { params(table: Lhm::Table, connection: T.nilable(Lhm::Connection)).void }
def initialize(table, connection = nil); end
sig { params(name: T.any(String, Symbol), definition: T.any(String, Symbol)).void }
def add_column(name, definition); end
sig do
params(
columns: T.any(String, Symbol, T::Array[T.any(String, Symbol)]),
index_name: T.nilable(String, Symbol)
).void
end
def add_index(columns, index_name = nil); end
sig do
params(
columns: T.any(String, Symbol, T::Array[T.any(String, Symbol)]),
index_name: T.nilable(String, Symbol)
).void
end
def add_unique_index(columns, index_name = nil); end
sig { params(name: T.any(String, Symbol), definition: T.any(String, Symbol)).void }
def change_column(name, definition); end
sig { returns(T::Array[String]) }
def conditions; end
sig { returns(T.nilable(Lhm::Connection)) }
def connection; end
sig { params(statement: String).void }
def ddl(statement); end
sig { params(sql: String).returns(String) }
def filter(sql); end
sig { returns(String) }
def name; end
sig { params(name: T.any(String, Symbol)).void }
def remove_column(name); end
sig do
params(
columns: T.any(String, Symbol, T::Array[T.any(String, Symbol)]),
index_name: T.nilable(String, Symbol)
).void
end
def remove_index(columns, index_name = nil); end
sig { params(old: T.any(String, Symbol), nu: T.any(String, Symbol)).void }
def rename_column(old, nu); end
sig { returns(T::Hash[T.untyped, T.untyped]) }
def renames; end
sig { returns(T::Array[String]) }
def statements; end
end
module Lhm::Throttler
sig { params(type: T.any(Lhm::Command, Symbol, String, Class), options: T.nilable(T::Hash[T.untyped, T.untyped])).void }
def setup_throttler(type, options = nil); end
sig { returns(T.self_type) }
def throttler; end
end
class Lhm::Throttler::Time
include Lhm::Command
sig { params(options: T.nilable(T::Hash[T.untyped, T.untyped])).void }
def initialize(options = nil); end
sig { void }
def execute; end
sig { returns(Integer) }
def stride; end
sig { params(arg0: Integer).returns(Integer) }
def stride=(arg0); end
sig { returns(Numeric) }
def timeout_seconds; end
sig { params(arg0: Numeric).returns(Numeric) }
def timeout_seconds=(arg0); end
end
class Lhm::Throttler::LegacyTime < Lhm::Throttler::Time
sig { params(timeout: T.nilable(Numeric), stride: T.nilable(Integer)).void }
def initialize(timeout, stride); end
end
class Lhm::Throttler::Factory
sig do
params(
type: T.any(Lhm::Command, Symbol, String, Class),
options: T.nilable(T::Hash[T.untyped, T.untyped])
).returns(T.untyped)
end
def self.create_throttler(type, options = nil); end
end