diamond-orm 0.1.0

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.
data/sig/diamond.rbs ADDED
@@ -0,0 +1,693 @@
1
+ # sig/diamond.rbs — static signatures for the Diamond persistence layer.
2
+ #
3
+ # Critical modeling decision: Table/QueryObject gain their query API
4
+ # at *runtime* (wake_up includes DSL/Domain modules guarded by
5
+ # include?). RBS declares those includes statically — they hold for
6
+ # any booted process, and without them `Users.where` never resolves.
7
+ # Same for the singleton extends on Diamond itself.
8
+ # Table proxies (`Users`) and `by_*` finders are runtime-bound and
9
+ # intentionally absent here — see sig/generated/tables.rbs and the
10
+ # ruby_lsp/houseki add-on respectively.
11
+
12
+ module Diamond
13
+ RACTOR_KEYS: Hash[Symbol, Symbol]
14
+ IDENT_RE: Regexp
15
+ RUNTIME_STATUS_CODES: Hash[Symbol, Integer]
16
+
17
+ VERSION: String
18
+
19
+ class Error < StandardError
20
+ end
21
+
22
+ class TableNotFound < Error
23
+ end
24
+
25
+ class RecordNotFound < Error
26
+ end
27
+
28
+ class InertObjectError < Error
29
+ end
30
+
31
+ class UnknownColumnError < StandardError
32
+ def self.build: (untyped schema, Symbol name) -> UnknownColumnError
33
+ end
34
+
35
+ class QueryInterruptedError < Error
36
+ end
37
+
38
+ class FeatureNotAvailableError < Error
39
+ end
40
+
41
+ extend Domains::DDL
42
+ extend Domains::CTE
43
+ extend DSL::Default
44
+
45
+ def self.quote_ident: (Symbol | String name) -> String
46
+ def self.validate_ident!: (Symbol | String name, ?String what) -> (Symbol | String)
47
+ def self.wake_up: (String db_path, ?busy_timeout: Integer?, ?gvl_release_threshold: Integer?, ?on_progress: Proc?, ?extensions: Array[String], ?auto_fiber_yield: bool) -> untyped
48
+ def self.fiber_yield_on_progress: (?untyped _busy) -> nil
49
+ def self.rebind_tables!: () -> Array[untyped]
50
+ def self.bind_tables!: () -> Hash[Symbol, untyped]?
51
+ def self.note_bound_table: (Symbol name) -> Array[Symbol]
52
+ def self.engine: () -> Diamond::Engine
53
+ def self.backup: (untyped target) { (Integer, Integer) -> untyped } -> untyped
54
+ def self.track_changes: (*Symbol tables) { () -> untyped } -> Diamond::Changeset
55
+ def self.query_with_timeout: (Integer seconds) { () -> untyped } -> untyped
56
+ def self.sleep: (Numeric seconds) -> untyped
57
+ def self.transaction: (?Symbol mode) { () -> untyped } -> untyped
58
+ def self.savepoint: (Symbol | String name) { () -> untyped } -> untyped
59
+ def self.tables: () -> Array[Symbol]
60
+ def self.busy_timeout=: (Integer val) -> Integer
61
+ def self.busy_timeout: () -> Integer?
62
+ def self.gvl_release_threshold=: (Integer val) -> Integer
63
+ def self.gvl_release_threshold: () -> Integer
64
+ def self.on_progress: () { (bool) -> untyped } -> untyped
65
+ def self.load_extension: (String path) -> untyped
66
+ def self.trace: () { (*untyped) -> untyped } -> untyped
67
+ def self.runtime_status: (Symbol code) -> untyped
68
+ def self.status: (Symbol code) -> [untyped, untyped]
69
+ def self.limit: (Symbol code, ?Integer? value) -> untyped
70
+ def self.clear_caches!: () -> untyped
71
+ end
72
+
73
+ # Installed on every Module; resolves table proxies, else NameError.
74
+ module DiamondConstMissing
75
+ def const_missing: (Symbol name) -> untyped
76
+ end
77
+
78
+ module Diamond
79
+ class Operator
80
+ end
81
+
82
+ class Engine
83
+ DBSTATUS_CODES: Hash[Symbol, Integer]
84
+ LIMIT_CODES: Hash[Symbol, Integer]
85
+
86
+ attr_reader db: untyped
87
+ attr_reader schema_cache: Hash[Symbol, untyped]
88
+ attr_reader foreign_keys: Hash[Symbol, untyped]
89
+ attr_reader prepared_cache: Hash[untyped, untyped]
90
+
91
+ def initialize: (String db_path, ?busy_timeout: Integer?, ?gvl_release_threshold: Integer?, ?on_progress: Proc?, ?extensions: Array[String]) -> void
92
+ def sync_scheduler_hook!: () -> bool
93
+ def reload_schema!: () -> Diamond::Engine
94
+ def freeze!: () -> Diamond::Engine
95
+ def load_one_table!: (Symbol table_name) -> Diamond::Engine
96
+ def busy_timeout: () -> Integer?
97
+ def busy_timeout=: (Integer val) -> Integer
98
+ def gvl_release_threshold: () -> Integer
99
+ def gvl_release_threshold=: (Integer val) -> Integer
100
+ def on_progress: () { (bool) -> untyped } -> untyped
101
+ def load_extension: (String path) -> untyped
102
+ def prepared: (String sql, ?Symbol mode) -> untyped
103
+ def status: (Symbol code) -> [untyped, untyped]
104
+ def limit: (Symbol code, ?Integer? value) -> untyped
105
+ end
106
+
107
+ class Table
108
+ include Enumerable[untyped]
109
+ include DSL::Default
110
+ include Domains::DQL
111
+ include Domains::DML
112
+ include Domains::DynamicFinders
113
+
114
+ attr_reader name: Symbol
115
+ attr_reader schema: Hash[Symbol, untyped]
116
+
117
+ def initialize: (Symbol name) -> void
118
+ def columns: () -> Array[Symbol]
119
+ def primary_key: () -> Symbol?
120
+ def []: (Integer id) -> untyped
121
+ def method_missing: (Symbol name, *untyped args, ?block: Proc?) -> untyped
122
+ def respond_to_missing?: (Symbol name, ?bool include_private) -> bool
123
+ end
124
+
125
+ class QueryObject
126
+ include Enumerable[untyped]
127
+ include DSL::Default
128
+ include Domains::DQL
129
+ include Domains::DML
130
+ include Domains::DynamicFinders
131
+
132
+ VALID_MODES: Array[Symbol]
133
+
134
+ attr_reader table: Diamond::Table
135
+ attr_reader ast: Array[untyped]
136
+ attr_reader mode: Symbol
137
+
138
+ def initialize: (Diamond::Table table, ?Array[untyped] ast) -> void
139
+ def materialize: () -> Array[untyped]
140
+ def as_hash: () -> Diamond::QueryObject
141
+ def as_array: () -> Diamond::QueryObject
142
+ def as_splat: () -> Diamond::QueryObject
143
+ def first: (?Integer n) -> untyped
144
+ def each: () { (untyped) -> untyped } -> untyped
145
+ def last: (?Integer n) -> untyped
146
+ def pluck: (*Symbol columns) -> Array[untyped]
147
+ def pick: (*Symbol columns) -> untyped
148
+ def ids: () -> Array[untyped]
149
+ def to_json_array: (*Symbol columns) -> Diamond::JsonString
150
+ def exists?: (?untyped filter) -> bool
151
+ def any?: (*untyped args) { (untyped) -> untyped } -> bool
152
+ def none?: (*untyped args) { (untyped) -> untyped } -> bool
153
+ def empty?: () -> bool
154
+ def count: (?Symbol? column) -> Integer
155
+ def sum: (?untyped column) ?{ (untyped) -> untyped } -> untyped
156
+ def minimum: (Symbol column) -> untyped
157
+ def maximum: (Symbol column) -> untyped
158
+ def average: (Symbol column) -> untyped
159
+ def avg: (Symbol column) -> untyped
160
+ def min: (?untyped column) { (untyped, untyped) -> untyped } -> untyped
161
+ def max: (?untyped column) { (untyped, untyped) -> untyped } -> untyped
162
+ def method_missing: (Symbol name, *untyped args, ?block: Proc?) -> untyped
163
+ def respond_to_missing?: (Symbol name, ?bool include_private) -> bool
164
+ def inspect: () -> String
165
+ def to_sql: () -> [String, Array[untyped]]
166
+ def explain: () -> Array[untyped]
167
+ def ast_tree: () -> String
168
+ end
169
+
170
+ class Changeset
171
+ def initialize: (untyped raw_changeset) -> void
172
+ def apply: (untyped target) -> untyped
173
+ def invert: () -> Diamond::Changeset
174
+ def to_blob: () -> String
175
+ def self.load: (String blob) -> Diamond::Changeset
176
+ end
177
+
178
+ class Cursor
179
+ include Enumerable[untyped]
180
+
181
+ def self.make_finalizer: (untyped stmt) -> Proc
182
+ def initialize: (Diamond::Table table, untyped stmt, untyped projected_columns) -> void
183
+ def each: () { (untyped) -> untyped } -> untyped
184
+ end
185
+
186
+ class NullTable
187
+ attr_reader name: Symbol?
188
+ attr_reader schema: Hash[Symbol, untyped]
189
+
190
+ def initialize: (?Symbol? name) -> void
191
+ end
192
+
193
+ module StructJSON
194
+ def to_json: (*untyped args) -> String
195
+ end
196
+
197
+ module StructFactory
198
+ def self.caches: () -> Hash[untyped, untyped]
199
+ def self.cache: () -> Hash[untyped, untyped]
200
+ def self.clear_caches!: () -> Hash[untyped, untyped]
201
+ def self.create: (Diamond::Table table, Hash[untyped, untyped] row_hash, ?untyped projection_nodes) -> untyped
202
+ def self.create_from_returning: (Diamond::Table table, untyped row, untyped columns) -> untyped
203
+ def self.create_eager: (Diamond::Table table, untyped row) -> untyped
204
+ def self.create_from_array: (Diamond::Table table, Array[untyped] row_array, ?untyped projection_nodes) -> untyped
205
+ def self.create_many: (Diamond::Table table, Array[untyped] rows, ?untyped projection_nodes) -> Array[untyped]
206
+ def self.factory_for: (Diamond::Table table, ?untyped projection_nodes) -> [Class, Integer]
207
+ def self.build: (Class factory, Array[untyped] row_array) -> untyped
208
+ def self.struct_class_for: (Diamond::Table table, Array[Symbol] member_names, untyped projection_nodes) -> Class
209
+ def self.resolve_members: (untyped projection_nodes, Diamond::Table table) -> Array[[Symbol, Symbol]]
210
+ def self.compile_node: (untyped node) -> Symbol
211
+ def self.member_name_for: (untyped node) -> Symbol
212
+ end
213
+
214
+ class JsonString < String
215
+ end
216
+
217
+ module AST
218
+ class Node
219
+ def &: (AST::Node other) -> AST::And
220
+ def |: (AST::Node other) -> AST::Or
221
+ end
222
+
223
+ class Column < Node
224
+ attr_reader name: Symbol
225
+ attr_reader table: Symbol?
226
+
227
+ def initialize: (Symbol name, ?table: Symbol?) -> void
228
+ def ==: (untyped other) -> AST::Equality
229
+ def !=: (untyped other) -> AST::NotEqual
230
+ def >: (untyped other) -> AST::GreaterThan
231
+ def <: (untyped other) -> AST::LessThan
232
+ end
233
+
234
+ class Literal < Node
235
+ attr_reader value: untyped
236
+
237
+ def initialize: (untyped value) -> void
238
+ end
239
+
240
+ class BinaryOp < Node
241
+ attr_reader left: AST::Node
242
+ attr_reader right: AST::Node
243
+ attr_reader operator: Symbol
244
+
245
+ def initialize: (AST::Node left, AST::Node right, Symbol operator) -> void
246
+ end
247
+
248
+ class Equality < BinaryOp
249
+ def initialize: (AST::Node left, AST::Node right) -> void
250
+ end
251
+
252
+ class NotEqual < BinaryOp
253
+ def initialize: (AST::Node left, AST::Node right) -> void
254
+ end
255
+
256
+ class GreaterThan < BinaryOp
257
+ def initialize: (AST::Node left, AST::Node right) -> void
258
+ end
259
+
260
+ class LessThan < BinaryOp
261
+ def initialize: (AST::Node left, AST::Node right) -> void
262
+ end
263
+
264
+ class GreaterEqual < BinaryOp
265
+ def initialize: (AST::Node left, AST::Node right) -> void
266
+ end
267
+
268
+ class LessEqual < BinaryOp
269
+ def initialize: (AST::Node left, AST::Node right) -> void
270
+ end
271
+
272
+ class Like < BinaryOp
273
+ def initialize: (AST::Node left, AST::Node right) -> void
274
+ end
275
+
276
+ class In < Node
277
+ attr_reader left: AST::Node
278
+ attr_reader right: untyped
279
+
280
+ def initialize: (AST::Node left, untyped right) -> void
281
+ end
282
+
283
+ class NotIn < Node
284
+ attr_reader left: AST::Node
285
+ attr_reader right: untyped
286
+
287
+ def initialize: (AST::Node left, untyped right) -> void
288
+ end
289
+
290
+ class Subquery < Node
291
+ attr_reader query: Diamond::QueryObject
292
+
293
+ def initialize: (Diamond::QueryObject query) -> void
294
+ end
295
+
296
+ class Not < Node
297
+ attr_reader condition: AST::Node
298
+
299
+ def initialize: (AST::Node condition) -> void
300
+ end
301
+
302
+ class IsNull < Node
303
+ attr_reader column: AST::Node
304
+
305
+ def initialize: (AST::Node column) -> void
306
+ end
307
+
308
+ class IsNotNull < Node
309
+ attr_reader column: AST::Node
310
+
311
+ def initialize: (AST::Node column) -> void
312
+ end
313
+
314
+ class Between < Node
315
+ attr_reader column: AST::Node
316
+ attr_reader low: AST::Node
317
+ attr_reader high: AST::Node
318
+
319
+ def initialize: (AST::Node column, AST::Node low, AST::Node high) -> void
320
+ end
321
+
322
+ class And < BinaryOp
323
+ def initialize: (AST::Node left, AST::Node right) -> void
324
+ end
325
+
326
+ class Or < BinaryOp
327
+ def initialize: (AST::Node left, AST::Node right) -> void
328
+ end
329
+
330
+ class Where < Node
331
+ attr_reader condition: AST::Node
332
+
333
+ def initialize: (AST::Node condition) -> void
334
+ end
335
+
336
+ class Projection < Node
337
+ attr_reader columns: Array[untyped]
338
+
339
+ def initialize: (Array[untyped] columns) -> void
340
+ end
341
+
342
+ class Distinct < Node
343
+ end
344
+
345
+ class Join < Node
346
+ attr_reader table_name: Symbol
347
+ attr_reader type: Symbol
348
+ attr_reader on: untyped
349
+ attr_reader eager: bool
350
+
351
+ def initialize: (Symbol table_name, Symbol type, untyped on, ?eager: bool) -> void
352
+ end
353
+
354
+ class With < Node
355
+ attr_reader name: Symbol
356
+ attr_reader query: untyped
357
+ attr_reader recursive: bool
358
+
359
+ def initialize: (Symbol name, untyped query, ?recursive: bool) -> void
360
+ end
361
+
362
+ class Order < Node
363
+ attr_reader specs: Array[untyped]
364
+
365
+ def initialize: (Array[untyped] specs) -> void
366
+ end
367
+
368
+ class Limit < Node
369
+ attr_reader value: Integer
370
+
371
+ def initialize: (Integer value) -> void
372
+ end
373
+
374
+ class Offset < Node
375
+ attr_reader value: Integer
376
+
377
+ def initialize: (Integer value) -> void
378
+ end
379
+
380
+ class GroupBy < Node
381
+ attr_reader columns: Array[untyped]
382
+
383
+ def initialize: (Array[untyped] columns) -> void
384
+ end
385
+
386
+ class Having < Node
387
+ attr_reader condition: AST::Node
388
+
389
+ def initialize: (AST::Node condition) -> void
390
+ end
391
+
392
+ class From < Node
393
+ attr_reader name: Symbol
394
+
395
+ def initialize: (Symbol name) -> void
396
+ end
397
+
398
+ class Function < Node
399
+ attr_reader name: Symbol
400
+ attr_reader args: Array[untyped]
401
+
402
+ def initialize: (Symbol name, Array[untyped] args) -> void
403
+ end
404
+
405
+ class WindowFunction < Node
406
+ attr_reader func_name: Symbol
407
+ attr_reader args: Array[untyped]
408
+ attr_reader partition_by: Array[untyped]
409
+ attr_reader order_by: Array[untyped]
410
+
411
+ def initialize: (Symbol func_name, Array[untyped] args, ?partition_by: Array[untyped], ?order_by: Array[untyped]) -> void
412
+ end
413
+
414
+ class Union < Node
415
+ attr_reader left: Diamond::QueryObject
416
+ attr_reader right: Diamond::QueryObject
417
+ attr_reader operator: String
418
+
419
+ def initialize: (Diamond::QueryObject left, Diamond::QueryObject right, ?String operator) -> void
420
+ end
421
+
422
+ class DefineRelation < Node
423
+ attr_reader name: Symbol
424
+ attr_reader columns: Array[untyped]
425
+
426
+ def initialize: (Symbol name, Array[untyped] columns) -> void
427
+ end
428
+
429
+ class ColumnDefinition < Node
430
+ attr_reader name: Symbol
431
+ attr_reader type: untyped
432
+ attr_reader options: Hash[untyped, untyped]
433
+
434
+ def initialize: (Symbol name, untyped type, ?Hash[untyped, untyped] options) -> void
435
+ end
436
+
437
+ class ForeignKey < Node
438
+ attr_reader local_column: Symbol
439
+ attr_reader ref_table: Symbol
440
+ attr_reader ref_column: Symbol
441
+ attr_reader on_delete: Symbol?
442
+ attr_reader on_update: Symbol?
443
+
444
+ def initialize: (Symbol local_column, Symbol ref_table, ?Symbol ref_column, ?on_delete: Symbol?, ?on_update: Symbol?) -> void
445
+ end
446
+
447
+ class IndexDefinition < Node
448
+ attr_reader name: Symbol
449
+ attr_reader columns: Array[untyped]
450
+ attr_reader unique: bool
451
+
452
+ def initialize: (Symbol name, Array[untyped] columns, ?unique: bool) -> void
453
+ end
454
+
455
+ class Insert < Node
456
+ attr_reader data: untyped
457
+
458
+ def initialize: (untyped data) -> void
459
+ end
460
+
461
+ class Update < Node
462
+ attr_reader data: untyped
463
+
464
+ def initialize: (untyped data) -> void
465
+ end
466
+
467
+ class Delete < Node
468
+ end
469
+
470
+ def self.dump: (AST::Node node, ?Integer indent) -> String
471
+ end
472
+
473
+ module Parser
474
+ WINDOW_FUNCS: Array[Symbol]
475
+ AGGREGATIONS: Array[Symbol]
476
+ DDL_METHODS: Array[Symbol]
477
+ DDL_FK_ACTIONS: Array[Symbol]
478
+
479
+ class BlockMismatch < StandardError
480
+ end
481
+
482
+ def self.caches: () -> Hash[untyped, untyped]
483
+ def self.clear_caches!: () -> Hash[untyped, untyped]
484
+ def self.cache_for: (untyped purpose) -> Hash[untyped, untyped]
485
+ def self.line_cache: () -> Hash[untyped, untyped]
486
+ def self.parse_block: (untyped block, untyped schema, ?untyped scope) -> AST::Node
487
+ def self.parse_block_with_prism: (untyped block, untyped schema, ?untyped scope) -> AST::Node
488
+ def self.parse_derive: (untyped block, untyped schema) -> Array[AST::Node]
489
+ def self.parse_derive_with_prism: (untyped block, untyped schema) -> Array[AST::Node]
490
+ def self.parse_ddl: (untyped block) -> Array[untyped]
491
+ def self.parse_ddl_with_prism: (untyped block) -> Array[untyped]
492
+ def self.parse_update: (untyped block, untyped schema) -> Hash[untyped, untyped]
493
+ def self.parse_update_with_prism: (untyped block, untyped schema) -> Hash[untyped, untyped]
494
+
495
+ # Runtime fallback for blocks with no source file on disk
496
+ # (irb/eval/-e/pry). Placeholder internals (SchemaProxy,
497
+ # ColumnRef, DdlRecorder, ...) are intentionally undeclared.
498
+ module Proxy
499
+ def self.file_backed?: (untyped block) -> bool
500
+ def self.parse_where: (untyped block, untyped schema, ?untyped scope) -> AST::Node
501
+ def self.parse_derive: (untyped block, untyped schema) -> Array[AST::Node]
502
+ def self.parse_ddl: (untyped block) -> Array[untyped]
503
+ def self.parse_update: (untyped block, untyped schema) -> Hash[untyped, untyped]
504
+ end
505
+ def self.candidate_blocks: (String file, Integer line) -> Array[untyped]
506
+ def self.index_file_blocks: (String file) -> untyped
507
+ def self.translate_where: (untyped node, untyped schema, ?untyped scope) -> AST::Node
508
+ def self.translate_receiver: (untyped node, untyped schema, untyped scope) -> AST::Node
509
+ def self.translate_derive: (untyped node, untyped schema) -> AST::Node
510
+ def self.translate_ddl_stmt: (untyped node) -> untyped
511
+ def self.split_args: (untyped call_node) -> [Array[untyped], Hash[untyped, untyped]]
512
+ def self.validate_column!: (untyped name, untyped schema) -> nil
513
+ def self.literal_value: (untyped node) -> untyped
514
+
515
+ module WhereOperators
516
+ def self.builtins: () -> Array[untyped]
517
+ def self.handlers: () -> Array[untyped]
518
+ def self.register: (untyped operator) -> nil
519
+ def self.clear!: () -> Array[untyped]
520
+ def self.call: (untyped node, untyped schema) -> untyped
521
+ end
522
+
523
+ module DeriveOperators
524
+ def self.builtins: () -> Array[untyped]
525
+ def self.handlers: () -> Array[untyped]
526
+ def self.register: (untyped operator) -> nil
527
+ def self.clear!: () -> Array[untyped]
528
+ def self.call: (untyped node, untyped schema) -> untyped
529
+ end
530
+ end
531
+
532
+ module Compiler
533
+ module Base
534
+ def self.compile: (Diamond::Table table, Array[untyped] ast, ?Array[untyped]? params) -> [String, Array[untyped], untyped]
535
+ end
536
+
537
+ module DQL
538
+ JOIN_TYPE_MAP: Hash[Symbol, String]
539
+
540
+ def self.compile: (Diamond::Table table, Array[untyped] ast, ?Array[untyped] params) -> [String, Array[untyped], untyped]
541
+ def self.translate_node: (untyped node, Array[untyped] params, ?prefix: String) -> String
542
+ def self.render_projection: (untyped node, Array[untyped] params) -> String
543
+ def self.column_sql: (untyped col, ?String prefix) -> String
544
+ end
545
+
546
+ module DML
547
+ def self.compile_insert: (Diamond::Table table, AST::Insert insert_node, ?returning: Array[untyped]) -> untyped
548
+ def self.compile_update: (Diamond::Table table, Hash[untyped, untyped] hash, Array[untyped] where_nodes, ?returning: Array[untyped]) -> untyped
549
+ def self.compile_delete: (Diamond::Table table, Array[untyped] where_nodes, ?returning: Array[untyped]) -> untyped
550
+ end
551
+
552
+ module DDL
553
+ TYPE_MAP: Hash[untyped, String]
554
+
555
+ def self.compile: (untyped node) -> [String, Array[untyped]]
556
+ def self.compile_add_column: (Symbol table_name, AST::ColumnDefinition coldef) -> [String, Array[untyped]]
557
+ def self.compile_index: (AST::IndexDefinition index_node, Symbol table_name) -> [String, Array[untyped]]
558
+ end
559
+
560
+ module Operators
561
+ def self.builtins: () -> Array[untyped]
562
+ def self.handlers: () -> Array[untyped]
563
+ def self.register: (untyped operator) -> nil
564
+ def self.clear!: () -> Array[untyped]
565
+ def self.call: (untyped node, Array[untyped] params) -> String?
566
+ end
567
+ end
568
+
569
+ module Domains
570
+ module DQL
571
+ RECONCILE: Hash[untyped, Symbol]
572
+ HASH_OPERATORS: Array[Symbol]
573
+
574
+ def _chain: (AST::Node node, ?strategy: Symbol?) -> Diamond::QueryObject
575
+ def _build_where: () { () -> untyped } -> Diamond::QueryObject
576
+ def _build_or_where: () { () -> untyped } -> Diamond::QueryObject
577
+ def dispatch_where_arg: (untyped arg) -> Diamond::QueryObject
578
+ def _build_join: (Symbol table_name, Symbol type, untyped on, ?eager: bool) -> Diamond::QueryObject
579
+ def _build_includes: (*Symbol tables) -> Diamond::QueryObject
580
+ def _build_order: (*untyped args, **untyped kwargs) -> Diamond::QueryObject
581
+ def _build_reorder: (*untyped args, **untyped kwargs) -> Diamond::QueryObject
582
+ def _order_pairs: (*untyped args, **untyped kwargs) -> Array[untyped]
583
+ def _build_limit: (Integer n) -> Diamond::QueryObject
584
+ def _build_offset: (Integer n) -> Diamond::QueryObject
585
+ def _build_group: (Array[untyped] columns) -> Diamond::QueryObject
586
+ def _build_having: () { () -> untyped } -> Diamond::QueryObject
587
+ def _build_projection: (*untyped args) { () -> untyped } -> Diamond::QueryObject
588
+ end
589
+
590
+ module DML
591
+ def _build_create: (Hash[untyped, untyped] hash, ?returning: Array[untyped]) -> untyped
592
+ def _build_update: (?returning: Array[untyped]) { () -> untyped } -> untyped
593
+ def _build_delete: (?returning: Array[untyped]) -> untyped
594
+ def batch_create: (Array[untyped] records) -> Integer
595
+ def insert_all: (Array[untyped] records) -> Integer
596
+ def batch_update: (Hash[untyped, untyped] set_hash, ?returning: Array[untyped]) -> untyped
597
+ end
598
+
599
+ module DDL
600
+ def _build_relation: (Symbol name) { () -> untyped } -> AST::DefineRelation
601
+ end
602
+
603
+ module CTE
604
+ def with: (Hash[Symbol, untyped] cte_hash) { (untyped) -> untyped } -> Diamond::QueryObject
605
+ def with_recursive: (Symbol name, Diamond::QueryObject base_query, Diamond::QueryObject recursive_query) -> Diamond::QueryObject
606
+ end
607
+
608
+ module DynamicFinders
609
+ FINDER_PREFIX: String
610
+ AND_SEPARATOR: String
611
+
612
+ def self.cache: () -> Hash[untyped, untyped]
613
+ def self.clear_caches!: () -> Hash[untyped, untyped]
614
+ def method_missing: (Symbol name, *untyped args, ?block: Proc?) -> Diamond::QueryObject
615
+ def respond_to_missing?: (Symbol name, ?bool include_private) -> bool
616
+ end
617
+ end
618
+
619
+ module DSL
620
+ module Default
621
+ def where: (*untyped args) { () -> untyped } -> Diamond::QueryObject
622
+ def or: () { () -> untyped } -> Diamond::QueryObject
623
+ def find: (?untyped id) ?{ (untyped) -> untyped } -> untyped
624
+ def find!: (Integer id) -> untyped
625
+ def where_in: (Symbol column, Diamond::QueryObject subquery) -> Diamond::QueryObject
626
+ def union: (Diamond::QueryObject other) -> Diamond::QueryObject
627
+ def derive: (*untyped args) { () -> untyped } -> Diamond::QueryObject
628
+ def join: (Symbol table_name, ?on: untyped, ?type: Symbol, ?eager: bool) -> Diamond::QueryObject
629
+ def includes: (*Symbol tables) -> Diamond::QueryObject
630
+ def define_relation: (Symbol name) { () -> untyped } -> AST::DefineRelation
631
+ def create_index: (Symbol table_name, Array[untyped] columns, ?unique: bool, name: Symbol) -> AST::IndexDefinition
632
+ def alter_table: (Symbol table_name) { () -> untyped } -> Array[untyped]
633
+ def create: (**untyped kwargs) -> untyped
634
+ def update: (?returning: Array[untyped]) { () -> untyped } -> untyped
635
+ def delete: (?returning: Array[untyped]) -> untyped
636
+ def from_cte: (Symbol alias_name) -> Diamond::QueryObject
637
+ def order: (*untyped args, **untyped kwargs) -> Diamond::QueryObject
638
+ def limit: (Integer n) -> Diamond::QueryObject
639
+ def offset: (Integer n) -> Diamond::QueryObject
640
+ def distinct: () -> Diamond::QueryObject
641
+ def group: (*untyped columns) -> Diamond::QueryObject
642
+ def having: () { () -> untyped } -> Diamond::QueryObject
643
+ def pluck: (*Symbol columns) -> Array[untyped]
644
+ def pick: (*Symbol columns) -> untyped
645
+ def ids: () -> Array[untyped]
646
+ def exists?: (?untyped filter) -> bool
647
+ def any?: (*untyped args) { (untyped) -> untyped } -> bool
648
+ def none?: (*untyped args) { (untyped) -> untyped } -> bool
649
+ def empty?: () -> bool
650
+ def count: (?Symbol? column) -> Integer
651
+ def sum: (?untyped column) ?{ (untyped) -> untyped } -> untyped
652
+ def minimum: (Symbol column) -> untyped
653
+ def maximum: (Symbol column) -> untyped
654
+ def average: (Symbol column) -> untyped
655
+ def avg: (Symbol column) -> untyped
656
+ def min: (?untyped column) { (untyped, untyped) -> untyped } -> untyped
657
+ def max: (?untyped column) { (untyped, untyped) -> untyped } -> untyped
658
+ def first: (?Integer n) -> untyped
659
+ def first!: () -> untyped
660
+ def last: (?Integer n) -> untyped
661
+ def last!: () -> untyped
662
+ def sole: () -> untyped
663
+ def head: (?Integer n) -> untyped
664
+ def each: () { (untyped) -> untyped } -> untyped
665
+ def as_hash: () -> Diamond::QueryObject
666
+ def as_array: () -> Diamond::QueryObject
667
+ def as_splat: () -> Diamond::QueryObject
668
+ def to_json_array: (*Symbol columns) -> Diamond::JsonString
669
+ def find_each: (?batch_size: Integer) { (untyped) -> untyped } -> untyped
670
+ def find_by: (**untyped attrs) -> untyped
671
+ def find_or_create_by: (**untyped attrs) -> untyped
672
+ def reorder: (*untyped args, **untyped kwargs) -> Diamond::QueryObject
673
+ def delete_all: (?returning: Array[untyped]) -> untyped
674
+ def update_all: (**untyped hash) -> untyped
675
+ def increment!: (Integer id, Symbol column, ?Integer by) -> untyped
676
+ def decrement!: (Integer id, Symbol column, ?Integer by) -> untyped
677
+ def toggle!: (Integer id, Symbol column) -> untyped
678
+ end
679
+ end
680
+
681
+ module Operators
682
+ module Like
683
+ PRIORITY: Integer
684
+
685
+ def self.priority: () -> Integer
686
+ def self.parse_where: (untyped node, untyped schema) -> AST::Node?
687
+ def self.handles?: (AST::Node node) -> bool
688
+ def self.render: (AST::Node node, Array[untyped] params) -> String
689
+ def self.regexp_to_like: (untyped regexp_node) -> String
690
+ def self.escape_like: (String ch) -> String
691
+ end
692
+ end
693
+ end