masonite-framework-orm 3.0.1__py3-none-any.whl
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.
- masonite_framework_orm-3.0.1.dist-info/METADATA +87 -0
- masonite_framework_orm-3.0.1.dist-info/RECORD +116 -0
- masonite_framework_orm-3.0.1.dist-info/WHEEL +5 -0
- masonite_framework_orm-3.0.1.dist-info/entry_points.txt +3 -0
- masonite_framework_orm-3.0.1.dist-info/licenses/LICENSE +21 -0
- masonite_framework_orm-3.0.1.dist-info/top_level.txt +1 -0
- masoniteorm/__init__.py +1 -0
- masoniteorm/collection/Collection.py +605 -0
- masoniteorm/collection/__init__.py +1 -0
- masoniteorm/commands/CanOverrideConfig.py +16 -0
- masoniteorm/commands/CanOverrideOptionsDefault.py +22 -0
- masoniteorm/commands/Command.py +6 -0
- masoniteorm/commands/Entry.py +43 -0
- masoniteorm/commands/MakeMigrationCommand.py +57 -0
- masoniteorm/commands/MakeModelCommand.py +78 -0
- masoniteorm/commands/MakeModelDocstringCommand.py +37 -0
- masoniteorm/commands/MakeObserverCommand.py +54 -0
- masoniteorm/commands/MakeSeedCommand.py +54 -0
- masoniteorm/commands/MigrateCommand.py +46 -0
- masoniteorm/commands/MigrateFreshCommand.py +41 -0
- masoniteorm/commands/MigrateRefreshCommand.py +41 -0
- masoniteorm/commands/MigrateResetCommand.py +25 -0
- masoniteorm/commands/MigrateRollbackCommand.py +26 -0
- masoniteorm/commands/MigrateStatusCommand.py +51 -0
- masoniteorm/commands/SeedRunCommand.py +35 -0
- masoniteorm/commands/ShellCommand.py +205 -0
- masoniteorm/commands/__init__.py +18 -0
- masoniteorm/commands/stubs/create_migration.stub +20 -0
- masoniteorm/commands/stubs/create_seed.stub +9 -0
- masoniteorm/commands/stubs/model.stub +9 -0
- masoniteorm/commands/stubs/observer.stub +101 -0
- masoniteorm/commands/stubs/table_migration.stub +19 -0
- masoniteorm/config.py +123 -0
- masoniteorm/connections/BaseConnection.py +101 -0
- masoniteorm/connections/ConnectionFactory.py +59 -0
- masoniteorm/connections/ConnectionResolver.py +132 -0
- masoniteorm/connections/MSSQLConnection.py +176 -0
- masoniteorm/connections/MySQLConnection.py +232 -0
- masoniteorm/connections/PostgresConnection.py +225 -0
- masoniteorm/connections/SQLiteConnection.py +179 -0
- masoniteorm/connections/__init__.py +6 -0
- masoniteorm/exceptions.py +38 -0
- masoniteorm/expressions/__init__.py +1 -0
- masoniteorm/expressions/expressions.py +288 -0
- masoniteorm/factories/Factory.py +112 -0
- masoniteorm/factories/__init__.py +1 -0
- masoniteorm/helpers/__init__.py +0 -0
- masoniteorm/helpers/misc.py +22 -0
- masoniteorm/migrations/Migration.py +330 -0
- masoniteorm/migrations/__init__.py +1 -0
- masoniteorm/models/MigrationModel.py +9 -0
- masoniteorm/models/Model.py +1209 -0
- masoniteorm/models/Model.pyi +1366 -0
- masoniteorm/models/Pivot.py +5 -0
- masoniteorm/models/__init__.py +1 -0
- masoniteorm/observers/ObservesEvents.py +27 -0
- masoniteorm/observers/__init__.py +1 -0
- masoniteorm/pagination/BasePaginator.py +10 -0
- masoniteorm/pagination/LengthAwarePaginator.py +34 -0
- masoniteorm/pagination/SimplePaginator.py +28 -0
- masoniteorm/pagination/__init__.py +2 -0
- masoniteorm/providers/ORMProvider.py +39 -0
- masoniteorm/providers/__init__.py +1 -0
- masoniteorm/query/EagerRelation.py +42 -0
- masoniteorm/query/QueryBuilder.py +2486 -0
- masoniteorm/query/__init__.py +1 -0
- masoniteorm/query/grammars/BaseGrammar.py +1027 -0
- masoniteorm/query/grammars/MSSQLGrammar.py +194 -0
- masoniteorm/query/grammars/MySQLGrammar.py +238 -0
- masoniteorm/query/grammars/PostgresGrammar.py +213 -0
- masoniteorm/query/grammars/SQLiteGrammar.py +228 -0
- masoniteorm/query/grammars/__init__.py +4 -0
- masoniteorm/query/processors/MSSQLPostProcessor.py +58 -0
- masoniteorm/query/processors/MySQLPostProcessor.py +48 -0
- masoniteorm/query/processors/PostgresPostProcessor.py +49 -0
- masoniteorm/query/processors/SQLitePostProcessor.py +49 -0
- masoniteorm/query/processors/__init__.py +4 -0
- masoniteorm/relationships/BaseRelationship.py +161 -0
- masoniteorm/relationships/BelongsTo.py +124 -0
- masoniteorm/relationships/BelongsToMany.py +604 -0
- masoniteorm/relationships/HasMany.py +66 -0
- masoniteorm/relationships/HasManyThrough.py +269 -0
- masoniteorm/relationships/HasOne.py +111 -0
- masoniteorm/relationships/HasOneThrough.py +275 -0
- masoniteorm/relationships/MorphMany.py +152 -0
- masoniteorm/relationships/MorphOne.py +156 -0
- masoniteorm/relationships/MorphTo.py +111 -0
- masoniteorm/relationships/MorphToMany.py +108 -0
- masoniteorm/relationships/__init__.py +10 -0
- masoniteorm/schema/Blueprint.py +1161 -0
- masoniteorm/schema/Column.py +144 -0
- masoniteorm/schema/ColumnDiff.py +0 -0
- masoniteorm/schema/Constraint.py +5 -0
- masoniteorm/schema/ForeignKeyConstraint.py +28 -0
- masoniteorm/schema/Index.py +5 -0
- masoniteorm/schema/Schema.py +359 -0
- masoniteorm/schema/Table.py +94 -0
- masoniteorm/schema/TableDiff.py +86 -0
- masoniteorm/schema/__init__.py +3 -0
- masoniteorm/schema/platforms/MSSQLPlatform.py +367 -0
- masoniteorm/schema/platforms/MySQLPlatform.py +513 -0
- masoniteorm/schema/platforms/Platform.py +97 -0
- masoniteorm/schema/platforms/PostgresPlatform.py +551 -0
- masoniteorm/schema/platforms/SQLitePlatform.py +481 -0
- masoniteorm/schema/platforms/__init__.py +4 -0
- masoniteorm/scopes/BaseScope.py +6 -0
- masoniteorm/scopes/SoftDeleteScope.py +56 -0
- masoniteorm/scopes/SoftDeletesMixin.py +13 -0
- masoniteorm/scopes/TimeStampsMixin.py +12 -0
- masoniteorm/scopes/TimeStampsScope.py +47 -0
- masoniteorm/scopes/UUIDPrimaryKeyMixin.py +8 -0
- masoniteorm/scopes/UUIDPrimaryKeyScope.py +51 -0
- masoniteorm/scopes/__init__.py +8 -0
- masoniteorm/scopes/scope.py +15 -0
- masoniteorm/seeds/Seeder.py +42 -0
- masoniteorm/seeds/__init__.py +1 -0
|
@@ -0,0 +1,1366 @@
|
|
|
1
|
+
from typing import Any, Callable, Dict
|
|
2
|
+
|
|
3
|
+
from ..query.QueryBuilder import QueryBuilder
|
|
4
|
+
|
|
5
|
+
class Model:
|
|
6
|
+
|
|
7
|
+
# ==============================
|
|
8
|
+
# Model Methods
|
|
9
|
+
# ==============================
|
|
10
|
+
|
|
11
|
+
def add_relation(self, relations):
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
def append_passthrough(self, passthrough):
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
def attach(self, relation, related_record):
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
def all_attributes(self):
|
|
21
|
+
pass
|
|
22
|
+
|
|
23
|
+
def attach_related(self, relation, related_record):
|
|
24
|
+
pass
|
|
25
|
+
|
|
26
|
+
def boot(self):
|
|
27
|
+
pass
|
|
28
|
+
|
|
29
|
+
def cast_value(self, attribute: str, value: Any):
|
|
30
|
+
"""
|
|
31
|
+
Given an attribute name and a value, casts the value using the model's registered caster.
|
|
32
|
+
If no registered caster exists, returns the unmodified value.
|
|
33
|
+
"""
|
|
34
|
+
pass
|
|
35
|
+
|
|
36
|
+
def cast_values(self, attributes: Dict[str, Any]) -> Dict[str, Any]:
|
|
37
|
+
"""
|
|
38
|
+
Runs provided dictionary through all model casters and returns the result.
|
|
39
|
+
|
|
40
|
+
Does not mutate the passed dictionary.
|
|
41
|
+
"""
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
@classmethod
|
|
45
|
+
def create(
|
|
46
|
+
cls,
|
|
47
|
+
dictionary=None,
|
|
48
|
+
query=False,
|
|
49
|
+
cast=True,
|
|
50
|
+
ignore_mass_assignment: bool = False,
|
|
51
|
+
**kwargs,
|
|
52
|
+
):
|
|
53
|
+
"""Creates new records based off of a dictionary as well as data set on the model
|
|
54
|
+
such as fillable values.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
dictionary (dict, optional): [description]. Defaults to {}.
|
|
58
|
+
query (bool, optional): [description]. Defaults to False.
|
|
59
|
+
cast (bool, optional): [description]. Whether to cast passed values.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
self: A hydrated version of a model
|
|
63
|
+
"""
|
|
64
|
+
pass
|
|
65
|
+
|
|
66
|
+
def delete_attribute(self, key):
|
|
67
|
+
pass
|
|
68
|
+
|
|
69
|
+
def delete_quietly(self):
|
|
70
|
+
"""This method calls the delete method on a model without firing the delete & deleting observer events.
|
|
71
|
+
Instead of calling:
|
|
72
|
+
|
|
73
|
+
User().delete(...)
|
|
74
|
+
|
|
75
|
+
you can use this:
|
|
76
|
+
|
|
77
|
+
User.delete_quietly(...)
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
self
|
|
81
|
+
"""
|
|
82
|
+
pass
|
|
83
|
+
|
|
84
|
+
def detach(self, relation, related_record):
|
|
85
|
+
pass
|
|
86
|
+
|
|
87
|
+
def detach_many(self, relation, relating_records):
|
|
88
|
+
pass
|
|
89
|
+
|
|
90
|
+
def fill(self, attributes):
|
|
91
|
+
pass
|
|
92
|
+
|
|
93
|
+
def fill_original(self, attributes):
|
|
94
|
+
pass
|
|
95
|
+
|
|
96
|
+
@classmethod
|
|
97
|
+
def filter_fillable(cls, dictionary: Dict[str, Any]) -> Dict[str, Any]:
|
|
98
|
+
"""
|
|
99
|
+
Filters provided dictionary to only include fields specified in the model's __fillable__ property
|
|
100
|
+
|
|
101
|
+
Passed dictionary is not mutated.
|
|
102
|
+
"""
|
|
103
|
+
pass
|
|
104
|
+
|
|
105
|
+
@classmethod
|
|
106
|
+
def filter_mass_assignment(
|
|
107
|
+
cls, dictionary: Dict[str, Any]
|
|
108
|
+
) -> Dict[str, Any]:
|
|
109
|
+
"""
|
|
110
|
+
Filters the provided dictionary in preparation for a mass-assignment operation
|
|
111
|
+
|
|
112
|
+
Wrapper around filter_fillable() & filter_guarded(). Passed dictionary is not mutated.
|
|
113
|
+
"""
|
|
114
|
+
pass
|
|
115
|
+
|
|
116
|
+
@classmethod
|
|
117
|
+
def filter_guarded(cls, dictionary: Dict[str, Any]) -> Dict[str, Any]:
|
|
118
|
+
"""
|
|
119
|
+
Filters provided dictionary to exclude fields specified in the model's __guarded__ property
|
|
120
|
+
|
|
121
|
+
Passed dictionary is not mutated.
|
|
122
|
+
"""
|
|
123
|
+
pass
|
|
124
|
+
|
|
125
|
+
@classmethod
|
|
126
|
+
def find(cls, record_id, query=False):
|
|
127
|
+
"""Finds a row by the primary key ID.
|
|
128
|
+
|
|
129
|
+
Arguments:
|
|
130
|
+
record_id {int} -- The ID of the primary key to fetch.
|
|
131
|
+
|
|
132
|
+
Returns:
|
|
133
|
+
Model
|
|
134
|
+
"""
|
|
135
|
+
pass
|
|
136
|
+
|
|
137
|
+
@classmethod
|
|
138
|
+
def find_or_fail(cls, record_id, query=False):
|
|
139
|
+
"""Finds a row by the primary key ID or raise a ModelNotFound exception.
|
|
140
|
+
|
|
141
|
+
Arguments:
|
|
142
|
+
record_id {int} -- The ID of the primary key to fetch.
|
|
143
|
+
|
|
144
|
+
Returns:
|
|
145
|
+
Model
|
|
146
|
+
"""
|
|
147
|
+
pass
|
|
148
|
+
|
|
149
|
+
@classmethod
|
|
150
|
+
def first_or_create(cls, wheres, creates: dict = None):
|
|
151
|
+
"""Get the first record matching the attributes or create it.
|
|
152
|
+
|
|
153
|
+
Returns:
|
|
154
|
+
Model
|
|
155
|
+
"""
|
|
156
|
+
pass
|
|
157
|
+
|
|
158
|
+
def fresh(self):
|
|
159
|
+
pass
|
|
160
|
+
|
|
161
|
+
def get_builder(self):
|
|
162
|
+
pass
|
|
163
|
+
|
|
164
|
+
@classmethod
|
|
165
|
+
def get_columns(cls):
|
|
166
|
+
pass
|
|
167
|
+
|
|
168
|
+
def get_connection_details(self):
|
|
169
|
+
pass
|
|
170
|
+
|
|
171
|
+
def get_dates(self):
|
|
172
|
+
"""
|
|
173
|
+
Get the attributes that should be converted to dates.
|
|
174
|
+
|
|
175
|
+
:rtype: list
|
|
176
|
+
"""
|
|
177
|
+
pass
|
|
178
|
+
|
|
179
|
+
def get_dirty(self, key):
|
|
180
|
+
pass
|
|
181
|
+
|
|
182
|
+
def get_dirty_attributes(self):
|
|
183
|
+
pass
|
|
184
|
+
|
|
185
|
+
def get_dirty_keys(self):
|
|
186
|
+
pass
|
|
187
|
+
|
|
188
|
+
def get_dirty_value(self, attribute):
|
|
189
|
+
pass
|
|
190
|
+
|
|
191
|
+
def get_foreign_key(self):
|
|
192
|
+
"""Gets the foreign key based on this model name.
|
|
193
|
+
|
|
194
|
+
Args:
|
|
195
|
+
relationship (str): The relationship name.
|
|
196
|
+
|
|
197
|
+
Returns:
|
|
198
|
+
str
|
|
199
|
+
"""
|
|
200
|
+
pass
|
|
201
|
+
|
|
202
|
+
def get_new_date(self, _datetime=None):
|
|
203
|
+
"""
|
|
204
|
+
Get the attributes that should be converted to dates.
|
|
205
|
+
|
|
206
|
+
:rtype: list
|
|
207
|
+
"""
|
|
208
|
+
pass
|
|
209
|
+
|
|
210
|
+
def get_new_datetime_string(self, _datetime=None):
|
|
211
|
+
"""
|
|
212
|
+
Given an optional datetime value, constructs and returns a new datetime string.
|
|
213
|
+
If no datetime is specified, returns the current time.
|
|
214
|
+
|
|
215
|
+
:rtype: list
|
|
216
|
+
"""
|
|
217
|
+
pass
|
|
218
|
+
|
|
219
|
+
def get_new_serialized_date(self, _datetime):
|
|
220
|
+
"""
|
|
221
|
+
Get the attributes that should be converted to dates.
|
|
222
|
+
|
|
223
|
+
:rtype: list
|
|
224
|
+
"""
|
|
225
|
+
pass
|
|
226
|
+
|
|
227
|
+
def get_original(self, key):
|
|
228
|
+
pass
|
|
229
|
+
|
|
230
|
+
@classmethod
|
|
231
|
+
def get_primary_key(cls):
|
|
232
|
+
"""Gets the primary key column
|
|
233
|
+
|
|
234
|
+
Returns:
|
|
235
|
+
mixed
|
|
236
|
+
"""
|
|
237
|
+
pass
|
|
238
|
+
|
|
239
|
+
def get_primary_key_type(self):
|
|
240
|
+
"""Gets the primary key column type
|
|
241
|
+
|
|
242
|
+
Returns:
|
|
243
|
+
mixed
|
|
244
|
+
"""
|
|
245
|
+
pass
|
|
246
|
+
|
|
247
|
+
def get_primary_key_value(self):
|
|
248
|
+
"""Gets the primary key value.
|
|
249
|
+
|
|
250
|
+
Raises:
|
|
251
|
+
AttributeError: Raises attribute error if the model does not have an
|
|
252
|
+
attribute with the primary key.
|
|
253
|
+
|
|
254
|
+
Returns:
|
|
255
|
+
str|int
|
|
256
|
+
"""
|
|
257
|
+
pass
|
|
258
|
+
|
|
259
|
+
def get_selects(self):
|
|
260
|
+
pass
|
|
261
|
+
|
|
262
|
+
def get_raw_attribute(self, attribute):
|
|
263
|
+
"""Gets an attribute without having to call the models magic methods. Gets around infinite recursion loops.
|
|
264
|
+
|
|
265
|
+
Args:
|
|
266
|
+
attribute (string): The attribute to fetch
|
|
267
|
+
|
|
268
|
+
Returns:
|
|
269
|
+
mixed: Any value an attribute can be.
|
|
270
|
+
"""
|
|
271
|
+
pass
|
|
272
|
+
|
|
273
|
+
def get_related(self, relation):
|
|
274
|
+
pass
|
|
275
|
+
|
|
276
|
+
@classmethod
|
|
277
|
+
def get_table_name(cls):
|
|
278
|
+
"""Gets the table name.
|
|
279
|
+
|
|
280
|
+
Returns:
|
|
281
|
+
str
|
|
282
|
+
"""
|
|
283
|
+
pass
|
|
284
|
+
|
|
285
|
+
def get_value(self, attribute):
|
|
286
|
+
pass
|
|
287
|
+
|
|
288
|
+
@classmethod
|
|
289
|
+
def hydrate(cls, result, relations=None):
|
|
290
|
+
"""Takes a result and loads it into a model
|
|
291
|
+
|
|
292
|
+
Args:
|
|
293
|
+
result ([type]): [description]
|
|
294
|
+
relations (dict, optional): [description]. Defaults to {}.
|
|
295
|
+
|
|
296
|
+
Returns:
|
|
297
|
+
[type]: [description]
|
|
298
|
+
"""
|
|
299
|
+
pass
|
|
300
|
+
|
|
301
|
+
def is_created(self):
|
|
302
|
+
pass
|
|
303
|
+
|
|
304
|
+
def is_dirty(self):
|
|
305
|
+
pass
|
|
306
|
+
|
|
307
|
+
def is_loaded(self):
|
|
308
|
+
pass
|
|
309
|
+
|
|
310
|
+
@classmethod
|
|
311
|
+
def load(cls, *loads):
|
|
312
|
+
pass
|
|
313
|
+
|
|
314
|
+
@classmethod
|
|
315
|
+
def new_collection(cls, data):
|
|
316
|
+
"""Takes a result and puts it into a new collection.
|
|
317
|
+
This is designed to be able to be overridden by the user.
|
|
318
|
+
|
|
319
|
+
Args:
|
|
320
|
+
data (list|dict): Could be any data type but will be loaded directly into a collection.
|
|
321
|
+
|
|
322
|
+
Returns:
|
|
323
|
+
Collection
|
|
324
|
+
"""
|
|
325
|
+
pass
|
|
326
|
+
|
|
327
|
+
def query(self):
|
|
328
|
+
pass
|
|
329
|
+
|
|
330
|
+
def related(self, relation):
|
|
331
|
+
pass
|
|
332
|
+
|
|
333
|
+
def relations_to_dict(self):
|
|
334
|
+
"""Converts a models relationships to a dictionary
|
|
335
|
+
|
|
336
|
+
Returns:
|
|
337
|
+
[type]: [description]
|
|
338
|
+
"""
|
|
339
|
+
pass
|
|
340
|
+
|
|
341
|
+
def save(self, query=False):
|
|
342
|
+
pass
|
|
343
|
+
|
|
344
|
+
def save_many(self, relation, relating_records):
|
|
345
|
+
pass
|
|
346
|
+
|
|
347
|
+
def save_quietly(self):
|
|
348
|
+
"""This method calls the save method on a model without firing the saved & saving observer events. Saved/Saving
|
|
349
|
+
are toggled back on once save_quietly has been run.
|
|
350
|
+
|
|
351
|
+
Instead of calling:
|
|
352
|
+
|
|
353
|
+
User().save(...)
|
|
354
|
+
|
|
355
|
+
you can use this:
|
|
356
|
+
|
|
357
|
+
User.save_quietly(...)
|
|
358
|
+
"""
|
|
359
|
+
pass
|
|
360
|
+
|
|
361
|
+
def serialize(self, exclude=None, include=None):
|
|
362
|
+
"""Takes the data as a model and converts it into a dictionary.
|
|
363
|
+
|
|
364
|
+
Returns:
|
|
365
|
+
dict
|
|
366
|
+
"""
|
|
367
|
+
pass
|
|
368
|
+
|
|
369
|
+
def set_appends(self, appends):
|
|
370
|
+
"""
|
|
371
|
+
Get the attributes that should be converted to dates.
|
|
372
|
+
|
|
373
|
+
:rtype: list
|
|
374
|
+
"""
|
|
375
|
+
pass
|
|
376
|
+
|
|
377
|
+
@classmethod
|
|
378
|
+
def table(cls, table):
|
|
379
|
+
"""Gets the table name.
|
|
380
|
+
|
|
381
|
+
Returns:
|
|
382
|
+
str
|
|
383
|
+
"""
|
|
384
|
+
pass
|
|
385
|
+
|
|
386
|
+
def to_json(self):
|
|
387
|
+
"""Converts a model to JSON
|
|
388
|
+
|
|
389
|
+
Returns:
|
|
390
|
+
string
|
|
391
|
+
"""
|
|
392
|
+
pass
|
|
393
|
+
|
|
394
|
+
def touch(self, date=None, query=True):
|
|
395
|
+
"""Updates the current timestamps on the model"""
|
|
396
|
+
|
|
397
|
+
pass
|
|
398
|
+
|
|
399
|
+
@classmethod
|
|
400
|
+
def update_or_create(cls, wheres, updates):
|
|
401
|
+
pass
|
|
402
|
+
# ==============================
|
|
403
|
+
# QueryBuilder passthrough methods
|
|
404
|
+
# all marked as @classmethod for IDE
|
|
405
|
+
# autocomplete to work correctly
|
|
406
|
+
# ==============================
|
|
407
|
+
|
|
408
|
+
@classmethod
|
|
409
|
+
def add_select(cls, alias: str, callable: Any) -> QueryBuilder:
|
|
410
|
+
"""Specifies columns that should be selected
|
|
411
|
+
|
|
412
|
+
Returns:
|
|
413
|
+
self
|
|
414
|
+
"""
|
|
415
|
+
pass
|
|
416
|
+
|
|
417
|
+
@classmethod
|
|
418
|
+
def aggregate(
|
|
419
|
+
cls, aggregate: str, column: str, alias: str
|
|
420
|
+
) -> QueryBuilder:
|
|
421
|
+
"""Helper function to aggregate.
|
|
422
|
+
|
|
423
|
+
Arguments:
|
|
424
|
+
aggregate {string} -- The name of the aggregation.
|
|
425
|
+
column {string} -- The name of the column to aggregate.
|
|
426
|
+
"""
|
|
427
|
+
pass
|
|
428
|
+
|
|
429
|
+
@classmethod
|
|
430
|
+
def all(cls, selects: list = [], query: bool = False):
|
|
431
|
+
"""Returns all records from the table.
|
|
432
|
+
|
|
433
|
+
Returns:
|
|
434
|
+
dictionary -- Returns a dictionary of results.
|
|
435
|
+
"""
|
|
436
|
+
pass
|
|
437
|
+
|
|
438
|
+
@classmethod
|
|
439
|
+
def avg(cls, column: str) -> QueryBuilder:
|
|
440
|
+
"""Aggregates a columns values.
|
|
441
|
+
|
|
442
|
+
Arguments:
|
|
443
|
+
column {string} -- The name of the column to aggregate.
|
|
444
|
+
|
|
445
|
+
Returns:
|
|
446
|
+
self
|
|
447
|
+
"""
|
|
448
|
+
pass
|
|
449
|
+
|
|
450
|
+
@classmethod
|
|
451
|
+
def between(
|
|
452
|
+
cls, column: str, low: str | int, high: str | int
|
|
453
|
+
) -> QueryBuilder:
|
|
454
|
+
"""Specifies a where between expression.
|
|
455
|
+
|
|
456
|
+
Arguments:
|
|
457
|
+
column {string} -- The name of the column.
|
|
458
|
+
low {string} -- The value on the low end.
|
|
459
|
+
high {string} -- The value on the high end.
|
|
460
|
+
|
|
461
|
+
Returns:
|
|
462
|
+
self
|
|
463
|
+
"""
|
|
464
|
+
pass
|
|
465
|
+
|
|
466
|
+
@classmethod
|
|
467
|
+
def bulk_create(cls, creates: list[dict], query: bool = False, cast=True):
|
|
468
|
+
pass
|
|
469
|
+
|
|
470
|
+
@classmethod
|
|
471
|
+
def chunk(cls, chunk_amount: str | int):
|
|
472
|
+
pass
|
|
473
|
+
|
|
474
|
+
@classmethod
|
|
475
|
+
def count(cls, column: str = None):
|
|
476
|
+
"""Aggregates a columns values.
|
|
477
|
+
|
|
478
|
+
Arguments:
|
|
479
|
+
column {string} -- The name of the column to aggregate.
|
|
480
|
+
|
|
481
|
+
Returns:
|
|
482
|
+
self
|
|
483
|
+
"""
|
|
484
|
+
pass
|
|
485
|
+
|
|
486
|
+
@classmethod
|
|
487
|
+
def decrement(cls, column: str, value: int = 1):
|
|
488
|
+
"""Decrements a column's value.
|
|
489
|
+
|
|
490
|
+
Arguments:
|
|
491
|
+
column {string} -- The name of the column.
|
|
492
|
+
|
|
493
|
+
Keyword Arguments:
|
|
494
|
+
value {int} -- The value to decrement by. (default: {1})
|
|
495
|
+
|
|
496
|
+
Returns:
|
|
497
|
+
self
|
|
498
|
+
"""
|
|
499
|
+
pass
|
|
500
|
+
|
|
501
|
+
@classmethod
|
|
502
|
+
def delete(
|
|
503
|
+
cls, column: str = None, value: str = None, query: bool = False
|
|
504
|
+
):
|
|
505
|
+
"""Specify the column and value to delete
|
|
506
|
+
or deletes everything based on a previously used where expression.
|
|
507
|
+
|
|
508
|
+
Keyword Arguments:
|
|
509
|
+
column {string} -- The name of the column (default: {None})
|
|
510
|
+
value {string|int} -- The value of the column (default: {None})
|
|
511
|
+
|
|
512
|
+
Returns:
|
|
513
|
+
self
|
|
514
|
+
"""
|
|
515
|
+
pass
|
|
516
|
+
|
|
517
|
+
@classmethod
|
|
518
|
+
def distinct(cls, boolean: bool = True) -> QueryBuilder:
|
|
519
|
+
"""Species that the select query should be a SELECT DISTINCT query."""
|
|
520
|
+
pass
|
|
521
|
+
|
|
522
|
+
@classmethod
|
|
523
|
+
def doesnt_exist(cls) -> bool:
|
|
524
|
+
"""Determines if any rows exist for the current query.
|
|
525
|
+
|
|
526
|
+
Returns:
|
|
527
|
+
Bool - True or False
|
|
528
|
+
"""
|
|
529
|
+
pass
|
|
530
|
+
|
|
531
|
+
@classmethod
|
|
532
|
+
def doesnt_have(cls) -> bool:
|
|
533
|
+
"""Determine if any related rows exist for the current query.
|
|
534
|
+
|
|
535
|
+
Returns:
|
|
536
|
+
Bool - True or False
|
|
537
|
+
"""
|
|
538
|
+
pass
|
|
539
|
+
|
|
540
|
+
@classmethod
|
|
541
|
+
def exists(cls) -> bool:
|
|
542
|
+
"""Determine if rows exist for the current query.
|
|
543
|
+
|
|
544
|
+
Returns:
|
|
545
|
+
Bool - True or False
|
|
546
|
+
"""
|
|
547
|
+
pass
|
|
548
|
+
|
|
549
|
+
def find_or(
|
|
550
|
+
self, record_id: int, callback: Callable, args=None, column=None
|
|
551
|
+
):
|
|
552
|
+
"""Finds a row by the primary key ID (Requires a model) or raise a ModelNotFound exception.
|
|
553
|
+
|
|
554
|
+
Arguments:
|
|
555
|
+
record_id {int} -- The ID of the primary key to fetch.
|
|
556
|
+
callback {Callable} -- The function to call if no record is found.
|
|
557
|
+
|
|
558
|
+
Returns:
|
|
559
|
+
Model|Callable
|
|
560
|
+
"""
|
|
561
|
+
pass
|
|
562
|
+
|
|
563
|
+
@classmethod
|
|
564
|
+
def find_or_404(cls, record_id: str | int):
|
|
565
|
+
"""Finds a row by the primary key ID (Requires a model) or raise an 404 exception.
|
|
566
|
+
|
|
567
|
+
Arguments:
|
|
568
|
+
record_id {int} -- The ID of the primary key to fetch.
|
|
569
|
+
|
|
570
|
+
Returns:
|
|
571
|
+
Model|HTTP404
|
|
572
|
+
"""
|
|
573
|
+
pass
|
|
574
|
+
|
|
575
|
+
@classmethod
|
|
576
|
+
def first(cls, fields: list = None, query: bool = False):
|
|
577
|
+
"""Gets the first record.
|
|
578
|
+
|
|
579
|
+
Returns:
|
|
580
|
+
dictionary -- Returns a dictionary of results.
|
|
581
|
+
"""
|
|
582
|
+
pass
|
|
583
|
+
|
|
584
|
+
@classmethod
|
|
585
|
+
def first_or_fail(cls, query: bool = False):
|
|
586
|
+
"""Returns the first row from database. If no result found a ModelNotFound exception.
|
|
587
|
+
|
|
588
|
+
Returns:
|
|
589
|
+
dictionary|ModelNotFound
|
|
590
|
+
"""
|
|
591
|
+
pass
|
|
592
|
+
|
|
593
|
+
@classmethod
|
|
594
|
+
def first_where(cls, column: str, *args):
|
|
595
|
+
"""Gets the first record with the given key / value pair"""
|
|
596
|
+
pass
|
|
597
|
+
|
|
598
|
+
@classmethod
|
|
599
|
+
def force_update(cls, updates: dict, dry: bool = False):
|
|
600
|
+
pass
|
|
601
|
+
|
|
602
|
+
@classmethod
|
|
603
|
+
def from_(cls, table: str) -> QueryBuilder:
|
|
604
|
+
"""Alias for the table method
|
|
605
|
+
|
|
606
|
+
Arguments:
|
|
607
|
+
table {string} -- The name of the table
|
|
608
|
+
|
|
609
|
+
Returns:
|
|
610
|
+
self
|
|
611
|
+
"""
|
|
612
|
+
pass
|
|
613
|
+
|
|
614
|
+
@classmethod
|
|
615
|
+
def from_raw(cls, table: str) -> QueryBuilder:
|
|
616
|
+
"""Alias for the table method
|
|
617
|
+
|
|
618
|
+
Arguments:
|
|
619
|
+
table {string} -- The name of the table
|
|
620
|
+
|
|
621
|
+
Returns:
|
|
622
|
+
self
|
|
623
|
+
"""
|
|
624
|
+
pass
|
|
625
|
+
|
|
626
|
+
@classmethod
|
|
627
|
+
def get(cls, selects: list = []):
|
|
628
|
+
"""Runs the select query built from the query builder.
|
|
629
|
+
|
|
630
|
+
Returns:
|
|
631
|
+
self
|
|
632
|
+
"""
|
|
633
|
+
pass
|
|
634
|
+
|
|
635
|
+
@classmethod
|
|
636
|
+
def group_by_raw(cls, query: str, bindings: list = None) -> QueryBuilder:
|
|
637
|
+
"""Specifies a column to group by.
|
|
638
|
+
|
|
639
|
+
Arguments:
|
|
640
|
+
query {string} -- A raw query
|
|
641
|
+
|
|
642
|
+
Returns:
|
|
643
|
+
self
|
|
644
|
+
"""
|
|
645
|
+
pass
|
|
646
|
+
|
|
647
|
+
@classmethod
|
|
648
|
+
def group_by(cls, column: str) -> QueryBuilder:
|
|
649
|
+
"""Specifies a column to group by.
|
|
650
|
+
|
|
651
|
+
Arguments:
|
|
652
|
+
column {string} -- The name of the column to group by.
|
|
653
|
+
|
|
654
|
+
Returns:
|
|
655
|
+
self
|
|
656
|
+
"""
|
|
657
|
+
pass
|
|
658
|
+
|
|
659
|
+
@classmethod
|
|
660
|
+
def has(cls, *relationships: str) -> QueryBuilder:
|
|
661
|
+
pass
|
|
662
|
+
|
|
663
|
+
@classmethod
|
|
664
|
+
def having(cls, column, equality="", value="") -> QueryBuilder:
|
|
665
|
+
"""Specifying a having expression.
|
|
666
|
+
|
|
667
|
+
Arguments:
|
|
668
|
+
column {string} -- The name of the column.
|
|
669
|
+
|
|
670
|
+
Keyword Arguments:
|
|
671
|
+
equality {string} -- An equality operator (default: {"="})
|
|
672
|
+
value {string} -- The value of the having expression (default: {""})
|
|
673
|
+
|
|
674
|
+
Returns:
|
|
675
|
+
self
|
|
676
|
+
"""
|
|
677
|
+
pass
|
|
678
|
+
|
|
679
|
+
@classmethod
|
|
680
|
+
def having_raw(cls, string: str) -> QueryBuilder:
|
|
681
|
+
"""Specifies raw SQL that should be injected into the having expression.
|
|
682
|
+
|
|
683
|
+
Arguments:
|
|
684
|
+
string {string} -- The raw query string.
|
|
685
|
+
|
|
686
|
+
Returns:
|
|
687
|
+
self
|
|
688
|
+
"""
|
|
689
|
+
pass
|
|
690
|
+
|
|
691
|
+
@classmethod
|
|
692
|
+
def increment(cls, column: str, value: int = 1):
|
|
693
|
+
"""Increments a column's value.
|
|
694
|
+
|
|
695
|
+
Arguments:
|
|
696
|
+
column {string} -- The name of the column.
|
|
697
|
+
|
|
698
|
+
Keyword Arguments:
|
|
699
|
+
value {int} -- The value to increment by. (default: {1})
|
|
700
|
+
|
|
701
|
+
Returns:
|
|
702
|
+
self
|
|
703
|
+
"""
|
|
704
|
+
pass
|
|
705
|
+
|
|
706
|
+
@classmethod
|
|
707
|
+
def in_random_order(cls) -> QueryBuilder:
|
|
708
|
+
"""Puts Query results in random order"""
|
|
709
|
+
pass
|
|
710
|
+
|
|
711
|
+
@classmethod
|
|
712
|
+
def join_on(
|
|
713
|
+
cls,
|
|
714
|
+
relationship: str,
|
|
715
|
+
callback: callable = None,
|
|
716
|
+
clause: str = "inner",
|
|
717
|
+
) -> QueryBuilder:
|
|
718
|
+
pass
|
|
719
|
+
|
|
720
|
+
@classmethod
|
|
721
|
+
def join(
|
|
722
|
+
self,
|
|
723
|
+
table: str,
|
|
724
|
+
column1: str = None,
|
|
725
|
+
equality: str = None,
|
|
726
|
+
column2: str = None,
|
|
727
|
+
clause: str = "inner",
|
|
728
|
+
) -> QueryBuilder:
|
|
729
|
+
"""Specifies a join expression.
|
|
730
|
+
|
|
731
|
+
Arguments:
|
|
732
|
+
table {string} -- The name of the table or an instance of JoinClause.
|
|
733
|
+
column1 {string} -- The name of the foreign table.
|
|
734
|
+
equality {string} -- The equality to join on.
|
|
735
|
+
column2 {string} -- The name of the local column.
|
|
736
|
+
|
|
737
|
+
Keyword Arguments:
|
|
738
|
+
clause {string} -- The action clause. (default: {"inner"})
|
|
739
|
+
|
|
740
|
+
Returns:
|
|
741
|
+
self
|
|
742
|
+
"""
|
|
743
|
+
pass
|
|
744
|
+
|
|
745
|
+
@classmethod
|
|
746
|
+
def joins(
|
|
747
|
+
cls, *relationships: list[str], clause: str = "inner"
|
|
748
|
+
) -> QueryBuilder:
|
|
749
|
+
pass
|
|
750
|
+
|
|
751
|
+
@classmethod
|
|
752
|
+
def last(cls, column: str = None, query: bool = False) -> QueryBuilder:
|
|
753
|
+
"""Gets the last record, ordered by column in descendant order or primary
|
|
754
|
+
key if no column is given.
|
|
755
|
+
|
|
756
|
+
Returns:
|
|
757
|
+
dictionary -- Returns a dictionary of results.
|
|
758
|
+
"""
|
|
759
|
+
pass
|
|
760
|
+
|
|
761
|
+
@classmethod
|
|
762
|
+
def latest(cls, *fields):
|
|
763
|
+
"""Gets the latest record.
|
|
764
|
+
|
|
765
|
+
Returns:
|
|
766
|
+
querybuilder
|
|
767
|
+
"""
|
|
768
|
+
pass
|
|
769
|
+
|
|
770
|
+
@classmethod
|
|
771
|
+
def left_join(
|
|
772
|
+
cls,
|
|
773
|
+
table: str,
|
|
774
|
+
column1: str = None,
|
|
775
|
+
equality: str = None,
|
|
776
|
+
column2: str = None,
|
|
777
|
+
) -> QueryBuilder:
|
|
778
|
+
"""A helper method to add a left join expression.
|
|
779
|
+
|
|
780
|
+
Arguments:
|
|
781
|
+
table {string} -- The name of the table to join on.
|
|
782
|
+
column1 {string} -- The name of the foreign table.
|
|
783
|
+
equality {string} -- The equality to join on.
|
|
784
|
+
column2 {string} -- The name of the local column.
|
|
785
|
+
|
|
786
|
+
Returns:
|
|
787
|
+
self
|
|
788
|
+
"""
|
|
789
|
+
pass
|
|
790
|
+
|
|
791
|
+
@classmethod
|
|
792
|
+
def limit(cls, amount: int) -> QueryBuilder:
|
|
793
|
+
"""Specifies a limit expression.
|
|
794
|
+
|
|
795
|
+
Arguments:
|
|
796
|
+
amount {int} -- The number of rows to limit.
|
|
797
|
+
|
|
798
|
+
Returns:
|
|
799
|
+
self
|
|
800
|
+
"""
|
|
801
|
+
pass
|
|
802
|
+
|
|
803
|
+
@classmethod
|
|
804
|
+
def lock_for_update(cls) -> QueryBuilder:
|
|
805
|
+
pass
|
|
806
|
+
|
|
807
|
+
@classmethod
|
|
808
|
+
def or_doesnt_have(cls, *relationships) -> QueryBuilder:
|
|
809
|
+
pass
|
|
810
|
+
|
|
811
|
+
@classmethod
|
|
812
|
+
def or_has(cls, *relationships) -> QueryBuilder:
|
|
813
|
+
pass
|
|
814
|
+
|
|
815
|
+
@classmethod
|
|
816
|
+
def make_lock(cls, lock: bool):
|
|
817
|
+
pass
|
|
818
|
+
|
|
819
|
+
@classmethod
|
|
820
|
+
def max(cls, column: str) -> QueryBuilder:
|
|
821
|
+
"""Aggregates a columns values.
|
|
822
|
+
|
|
823
|
+
Arguments:
|
|
824
|
+
column {string} -- The name of the column to aggregate.
|
|
825
|
+
|
|
826
|
+
Returns:
|
|
827
|
+
self
|
|
828
|
+
"""
|
|
829
|
+
pass
|
|
830
|
+
|
|
831
|
+
@classmethod
|
|
832
|
+
def min(cls, column: str) -> QueryBuilder:
|
|
833
|
+
"""Aggregates a columns values.
|
|
834
|
+
|
|
835
|
+
Arguments:
|
|
836
|
+
column {string} -- The name of the column to aggregate.
|
|
837
|
+
|
|
838
|
+
Returns:
|
|
839
|
+
self
|
|
840
|
+
"""
|
|
841
|
+
pass
|
|
842
|
+
|
|
843
|
+
@classmethod
|
|
844
|
+
def new(cls) -> QueryBuilder:
|
|
845
|
+
"""Creates a new QueryBuilder class.
|
|
846
|
+
|
|
847
|
+
Returns:
|
|
848
|
+
QueryBuilder -- The ORM QueryBuilder class.
|
|
849
|
+
"""
|
|
850
|
+
pass
|
|
851
|
+
|
|
852
|
+
@classmethod
|
|
853
|
+
def new_from_builder(
|
|
854
|
+
cls, from_builder: QueryBuilder = None
|
|
855
|
+
) -> QueryBuilder:
|
|
856
|
+
"""Creates a new QueryBuilder class.
|
|
857
|
+
|
|
858
|
+
Returns:
|
|
859
|
+
QueryBuilder -- The ORM QueryBuilder class.
|
|
860
|
+
"""
|
|
861
|
+
pass
|
|
862
|
+
|
|
863
|
+
@classmethod
|
|
864
|
+
def not_between(
|
|
865
|
+
cls, column: str, low: str | int, high: str | int
|
|
866
|
+
) -> QueryBuilder:
|
|
867
|
+
"""Specifies a where not between expression.
|
|
868
|
+
|
|
869
|
+
Arguments:
|
|
870
|
+
column {string} -- The name of the column.
|
|
871
|
+
low {string} -- The value on the low end.
|
|
872
|
+
high {string} -- The value on the high end.
|
|
873
|
+
|
|
874
|
+
Returns:
|
|
875
|
+
self
|
|
876
|
+
"""
|
|
877
|
+
pass
|
|
878
|
+
|
|
879
|
+
@classmethod
|
|
880
|
+
def offset(cls, amount: int) -> QueryBuilder:
|
|
881
|
+
"""Specifies an offset expression.
|
|
882
|
+
|
|
883
|
+
Arguments:
|
|
884
|
+
amount {int} -- The number of rows to limit.
|
|
885
|
+
|
|
886
|
+
Returns:
|
|
887
|
+
self
|
|
888
|
+
"""
|
|
889
|
+
pass
|
|
890
|
+
|
|
891
|
+
@classmethod
|
|
892
|
+
def oldest(cls, *fields) -> QueryBuilder:
|
|
893
|
+
"""Gets the oldest record.
|
|
894
|
+
|
|
895
|
+
Returns:
|
|
896
|
+
querybuilder
|
|
897
|
+
"""
|
|
898
|
+
pass
|
|
899
|
+
|
|
900
|
+
@classmethod
|
|
901
|
+
def on(cls, connection: str) -> QueryBuilder:
|
|
902
|
+
pass
|
|
903
|
+
|
|
904
|
+
@classmethod
|
|
905
|
+
def only(cls, attributes: list) -> dict:
|
|
906
|
+
pass
|
|
907
|
+
|
|
908
|
+
@classmethod
|
|
909
|
+
def or_where(cls, column: str | int, *args) -> QueryBuilder:
|
|
910
|
+
"""Specifies an or where query expression.
|
|
911
|
+
|
|
912
|
+
Arguments:
|
|
913
|
+
column {[type]} -- [description]
|
|
914
|
+
value {[type]} -- [description]
|
|
915
|
+
|
|
916
|
+
Returns:
|
|
917
|
+
[type] -- [description]
|
|
918
|
+
"""
|
|
919
|
+
pass
|
|
920
|
+
|
|
921
|
+
@classmethod
|
|
922
|
+
def or_where_null(cls, column: str) -> QueryBuilder:
|
|
923
|
+
"""Specifies a where expression where the column is NULL.
|
|
924
|
+
|
|
925
|
+
Arguments:
|
|
926
|
+
column {string} -- The name of the column.
|
|
927
|
+
|
|
928
|
+
Returns:
|
|
929
|
+
self
|
|
930
|
+
"""
|
|
931
|
+
pass
|
|
932
|
+
|
|
933
|
+
@classmethod
|
|
934
|
+
def or_where_exists(cls, value: "str|int|QueryBuilder") -> QueryBuilder:
|
|
935
|
+
"""Specifies a where exists expression.
|
|
936
|
+
|
|
937
|
+
Arguments:
|
|
938
|
+
value {string|int|QueryBuilder} -- A value to check for the existence of a query expression.
|
|
939
|
+
|
|
940
|
+
Returns:
|
|
941
|
+
self
|
|
942
|
+
"""
|
|
943
|
+
pass
|
|
944
|
+
|
|
945
|
+
@classmethod
|
|
946
|
+
def or_where_not_exists(
|
|
947
|
+
cls, value: "str|int|QueryBuilder"
|
|
948
|
+
) -> QueryBuilder:
|
|
949
|
+
"""Specifies a where exists expression.
|
|
950
|
+
|
|
951
|
+
Arguments:
|
|
952
|
+
value {string|int|QueryBuilder} -- A value to check for the existence of a query expression.
|
|
953
|
+
|
|
954
|
+
Returns:
|
|
955
|
+
self
|
|
956
|
+
"""
|
|
957
|
+
pass
|
|
958
|
+
|
|
959
|
+
@classmethod
|
|
960
|
+
def or_where_date(cls, column: str, date: Any) -> QueryBuilder:
|
|
961
|
+
"""Specifies a where DATE expression
|
|
962
|
+
|
|
963
|
+
Arguments:
|
|
964
|
+
column {string} -- The name of the column.
|
|
965
|
+
date {string|datetime|pendulum} -- The name of the column.
|
|
966
|
+
|
|
967
|
+
Returns:
|
|
968
|
+
self
|
|
969
|
+
"""
|
|
970
|
+
pass
|
|
971
|
+
|
|
972
|
+
@classmethod
|
|
973
|
+
def or_where_doesnt_have(cls, relationship, callback) -> QueryBuilder:
|
|
974
|
+
pass
|
|
975
|
+
|
|
976
|
+
@classmethod
|
|
977
|
+
def or_where_has(cls, relationship, callback) -> QueryBuilder:
|
|
978
|
+
pass
|
|
979
|
+
|
|
980
|
+
@classmethod
|
|
981
|
+
def order_by(
|
|
982
|
+
cls, column: str, direction: str = "ASC|DESC"
|
|
983
|
+
) -> QueryBuilder:
|
|
984
|
+
"""Specifies a column to order by.
|
|
985
|
+
|
|
986
|
+
Arguments:
|
|
987
|
+
column {string} -- The name of the column.
|
|
988
|
+
|
|
989
|
+
Keyword Arguments:
|
|
990
|
+
direction {string} -- Specify either ASC or DESC order. (default: {"ASC"})
|
|
991
|
+
|
|
992
|
+
Returns:
|
|
993
|
+
self
|
|
994
|
+
"""
|
|
995
|
+
pass
|
|
996
|
+
|
|
997
|
+
@classmethod
|
|
998
|
+
def order_by_raw(cls, query: str, bindings: list = None) -> QueryBuilder:
|
|
999
|
+
"""Specifies a column to order by.
|
|
1000
|
+
|
|
1001
|
+
Arguments:
|
|
1002
|
+
column {string} -- The name of the column.
|
|
1003
|
+
|
|
1004
|
+
Keyword Arguments:
|
|
1005
|
+
direction {string} -- Specify either ASC or DESC order. (default: {"ASC"})
|
|
1006
|
+
|
|
1007
|
+
Returns:
|
|
1008
|
+
self
|
|
1009
|
+
"""
|
|
1010
|
+
pass
|
|
1011
|
+
|
|
1012
|
+
@classmethod
|
|
1013
|
+
def paginate(cls, per_page: int, page: int = 1):
|
|
1014
|
+
pass
|
|
1015
|
+
|
|
1016
|
+
@classmethod
|
|
1017
|
+
def right_join(
|
|
1018
|
+
cls,
|
|
1019
|
+
table: str,
|
|
1020
|
+
column1: str = None,
|
|
1021
|
+
equality: str = None,
|
|
1022
|
+
column2: str = None,
|
|
1023
|
+
) -> QueryBuilder:
|
|
1024
|
+
"""A helper method to add a right join expression.
|
|
1025
|
+
|
|
1026
|
+
Arguments:
|
|
1027
|
+
table {string} -- The name of the table to join on.
|
|
1028
|
+
column1 {string} -- The name of the foreign table.
|
|
1029
|
+
equality {string} -- The equality to join on.
|
|
1030
|
+
column2 {string} -- The name of the local column.
|
|
1031
|
+
|
|
1032
|
+
Returns:
|
|
1033
|
+
self
|
|
1034
|
+
"""
|
|
1035
|
+
pass
|
|
1036
|
+
|
|
1037
|
+
@classmethod
|
|
1038
|
+
def select(cls, *args: str) -> QueryBuilder:
|
|
1039
|
+
"""Specifies columns that should be selected
|
|
1040
|
+
|
|
1041
|
+
Returns:
|
|
1042
|
+
self
|
|
1043
|
+
"""
|
|
1044
|
+
pass
|
|
1045
|
+
|
|
1046
|
+
@classmethod
|
|
1047
|
+
def select_raw(cls, query: str) -> QueryBuilder:
|
|
1048
|
+
"""Specifies raw SQL that should be injected into the select expression.
|
|
1049
|
+
|
|
1050
|
+
Returns:
|
|
1051
|
+
self
|
|
1052
|
+
"""
|
|
1053
|
+
pass
|
|
1054
|
+
|
|
1055
|
+
@classmethod
|
|
1056
|
+
def set_global_scope(
|
|
1057
|
+
cls,
|
|
1058
|
+
name: str = "",
|
|
1059
|
+
callable: callable = None,
|
|
1060
|
+
action: str = "select",
|
|
1061
|
+
):
|
|
1062
|
+
"""Sets the global scopes that should be used before creating the SQL.
|
|
1063
|
+
|
|
1064
|
+
Arguments:
|
|
1065
|
+
cls {masoniteorm.Model} -- An ORM model class.
|
|
1066
|
+
name {string} -- The name of the global scope.
|
|
1067
|
+
|
|
1068
|
+
Returns:
|
|
1069
|
+
self
|
|
1070
|
+
"""
|
|
1071
|
+
pass
|
|
1072
|
+
|
|
1073
|
+
@classmethod
|
|
1074
|
+
def set_schema(cls, schema):
|
|
1075
|
+
pass
|
|
1076
|
+
|
|
1077
|
+
@classmethod
|
|
1078
|
+
def shared_lock(cls):
|
|
1079
|
+
pass
|
|
1080
|
+
|
|
1081
|
+
@classmethod
|
|
1082
|
+
def simple_paginate(cls, per_page: int, page: int = 1) -> QueryBuilder:
|
|
1083
|
+
pass
|
|
1084
|
+
|
|
1085
|
+
@classmethod
|
|
1086
|
+
def skip(cls, *args, **kwargs) -> QueryBuilder:
|
|
1087
|
+
"""Alias for limit method."""
|
|
1088
|
+
pass
|
|
1089
|
+
|
|
1090
|
+
@classmethod
|
|
1091
|
+
def statement(cls, query: str, bindings: list = ()) -> QueryBuilder:
|
|
1092
|
+
pass
|
|
1093
|
+
|
|
1094
|
+
@classmethod
|
|
1095
|
+
def sum(cls, column: str) -> QueryBuilder:
|
|
1096
|
+
"""Aggregates a columns values.
|
|
1097
|
+
|
|
1098
|
+
Arguments:
|
|
1099
|
+
column {string} -- The name of the column to aggregate.
|
|
1100
|
+
|
|
1101
|
+
Returns:
|
|
1102
|
+
self
|
|
1103
|
+
"""
|
|
1104
|
+
pass
|
|
1105
|
+
|
|
1106
|
+
@classmethod
|
|
1107
|
+
def table_raw(cls, query: str) -> QueryBuilder:
|
|
1108
|
+
"""Sets a query as the table
|
|
1109
|
+
|
|
1110
|
+
Arguments:
|
|
1111
|
+
query {string} -- The query to use for the table
|
|
1112
|
+
|
|
1113
|
+
Returns:
|
|
1114
|
+
self
|
|
1115
|
+
"""
|
|
1116
|
+
pass
|
|
1117
|
+
|
|
1118
|
+
@classmethod
|
|
1119
|
+
def take(cls, *args, **kwargs) -> QueryBuilder:
|
|
1120
|
+
"""Alias for limit method"""
|
|
1121
|
+
pass
|
|
1122
|
+
|
|
1123
|
+
@classmethod
|
|
1124
|
+
def to_qmark(cls) -> str:
|
|
1125
|
+
"""Compiles the QueryBuilder class into a Qmark SQL statement.
|
|
1126
|
+
|
|
1127
|
+
Returns:
|
|
1128
|
+
self
|
|
1129
|
+
"""
|
|
1130
|
+
pass
|
|
1131
|
+
|
|
1132
|
+
@classmethod
|
|
1133
|
+
def to_sql(cls) -> str:
|
|
1134
|
+
"""Compiles the QueryBuilder class into a SQL statement.
|
|
1135
|
+
|
|
1136
|
+
Returns:
|
|
1137
|
+
self
|
|
1138
|
+
"""
|
|
1139
|
+
pass
|
|
1140
|
+
|
|
1141
|
+
@classmethod
|
|
1142
|
+
def truncate(cls, foreign_keys: bool = False) -> QueryBuilder:
|
|
1143
|
+
pass
|
|
1144
|
+
|
|
1145
|
+
def update(
|
|
1146
|
+
self,
|
|
1147
|
+
updates: dict,
|
|
1148
|
+
dry: bool = False,
|
|
1149
|
+
force: bool = False,
|
|
1150
|
+
cast: bool = True,
|
|
1151
|
+
ignore_mass_assignment: bool = False,
|
|
1152
|
+
):
|
|
1153
|
+
"""Specifies columns and values to be updated.
|
|
1154
|
+
|
|
1155
|
+
Arguments:
|
|
1156
|
+
updates {dictionary} -- A dictionary of columns and values to update.
|
|
1157
|
+
dry {bool, optional} -- Whether a query should actually run
|
|
1158
|
+
force {bool, optional} -- Force the update even if there are no changes
|
|
1159
|
+
cast {bool, optional} -- Run all values through model's casters
|
|
1160
|
+
|
|
1161
|
+
Returns:
|
|
1162
|
+
self
|
|
1163
|
+
"""
|
|
1164
|
+
pass
|
|
1165
|
+
|
|
1166
|
+
@classmethod
|
|
1167
|
+
def value(cls, column: str):
|
|
1168
|
+
pass
|
|
1169
|
+
|
|
1170
|
+
@classmethod
|
|
1171
|
+
def when(cls, conditional: bool, callback: callable) -> QueryBuilder:
|
|
1172
|
+
pass
|
|
1173
|
+
|
|
1174
|
+
@classmethod
|
|
1175
|
+
def where(cls, column: str, *args: Any) -> QueryBuilder:
|
|
1176
|
+
"""Specifies a where expression.
|
|
1177
|
+
|
|
1178
|
+
Arguments:
|
|
1179
|
+
column {string} -- The name of the column to search
|
|
1180
|
+
|
|
1181
|
+
Keyword Arguments:
|
|
1182
|
+
args {List} -- The operator and the value of the column to search. (default: {None})
|
|
1183
|
+
|
|
1184
|
+
Returns:
|
|
1185
|
+
self
|
|
1186
|
+
"""
|
|
1187
|
+
pass
|
|
1188
|
+
|
|
1189
|
+
@classmethod
|
|
1190
|
+
def where_between(cls, *args, **kwargs) -> QueryBuilder:
|
|
1191
|
+
"""Alias for between"""
|
|
1192
|
+
pass
|
|
1193
|
+
|
|
1194
|
+
@classmethod
|
|
1195
|
+
def where_column(cls, column1: str, column2: str) -> QueryBuilder:
|
|
1196
|
+
"""Specifies where two columns equal each other.
|
|
1197
|
+
|
|
1198
|
+
Arguments:
|
|
1199
|
+
column1 {string} -- The name of the column.
|
|
1200
|
+
column2 {string} -- The name of the column.
|
|
1201
|
+
|
|
1202
|
+
Returns:
|
|
1203
|
+
self
|
|
1204
|
+
"""
|
|
1205
|
+
pass
|
|
1206
|
+
|
|
1207
|
+
@classmethod
|
|
1208
|
+
def where_date(cls, column: str, date: Any) -> QueryBuilder:
|
|
1209
|
+
"""Specifies a where DATE expression
|
|
1210
|
+
|
|
1211
|
+
Arguments:
|
|
1212
|
+
column {string} -- The name of the column.
|
|
1213
|
+
|
|
1214
|
+
Returns:
|
|
1215
|
+
self
|
|
1216
|
+
"""
|
|
1217
|
+
pass
|
|
1218
|
+
|
|
1219
|
+
@classmethod
|
|
1220
|
+
def where_doesnt_have(cls, relationship, callback) -> QueryBuilder:
|
|
1221
|
+
pass
|
|
1222
|
+
|
|
1223
|
+
@classmethod
|
|
1224
|
+
def where_exists(cls, value: Any) -> QueryBuilder:
|
|
1225
|
+
"""Specifies a where exists expression.
|
|
1226
|
+
|
|
1227
|
+
Arguments:
|
|
1228
|
+
value {string|int|QueryBuilder} -- A value to check for the existence of a query expression.
|
|
1229
|
+
|
|
1230
|
+
Returns:
|
|
1231
|
+
self
|
|
1232
|
+
"""
|
|
1233
|
+
pass
|
|
1234
|
+
|
|
1235
|
+
@classmethod
|
|
1236
|
+
def where_from_builder(cls, builder: QueryBuilder) -> QueryBuilder:
|
|
1237
|
+
"""Specifies a where expression.
|
|
1238
|
+
|
|
1239
|
+
Arguments:
|
|
1240
|
+
column {string} -- The name of the column to search
|
|
1241
|
+
|
|
1242
|
+
Keyword Arguments:
|
|
1243
|
+
args {List} -- The operator and the value of the column to search. (default: {None})
|
|
1244
|
+
|
|
1245
|
+
Returns:
|
|
1246
|
+
self
|
|
1247
|
+
"""
|
|
1248
|
+
pass
|
|
1249
|
+
|
|
1250
|
+
@classmethod
|
|
1251
|
+
def where_has(cls, relationship: str, callback: Any) -> QueryBuilder:
|
|
1252
|
+
pass
|
|
1253
|
+
|
|
1254
|
+
@classmethod
|
|
1255
|
+
def where_in(cls, column: str, wheres: list = None) -> QueryBuilder:
|
|
1256
|
+
"""Specifies where a column contains a list of a values.
|
|
1257
|
+
|
|
1258
|
+
Arguments:
|
|
1259
|
+
column {string} -- The name of the column.
|
|
1260
|
+
|
|
1261
|
+
Keyword Arguments:
|
|
1262
|
+
wheres {list} -- A list of values (default: {[]})
|
|
1263
|
+
|
|
1264
|
+
Returns:
|
|
1265
|
+
self
|
|
1266
|
+
"""
|
|
1267
|
+
pass
|
|
1268
|
+
|
|
1269
|
+
@classmethod
|
|
1270
|
+
def where_like(cls, column: str, value: str) -> QueryBuilder:
|
|
1271
|
+
"""Specifies a where LIKE expression.
|
|
1272
|
+
|
|
1273
|
+
Arguments:
|
|
1274
|
+
column {string} -- The name of the column to search
|
|
1275
|
+
value {string} -- The value of the column to match
|
|
1276
|
+
|
|
1277
|
+
Returns:
|
|
1278
|
+
self
|
|
1279
|
+
"""
|
|
1280
|
+
pass
|
|
1281
|
+
|
|
1282
|
+
@classmethod
|
|
1283
|
+
def where_not_between(cls, *args: Any, **kwargs: Any) -> QueryBuilder:
|
|
1284
|
+
"""Alias for not_between"""
|
|
1285
|
+
pass
|
|
1286
|
+
|
|
1287
|
+
@classmethod
|
|
1288
|
+
def where_not_in(cls, column: str, wheres: list = None) -> QueryBuilder:
|
|
1289
|
+
"""Specifies where a column does not contain a list of a values.
|
|
1290
|
+
|
|
1291
|
+
Arguments:
|
|
1292
|
+
column {string} -- The name of the column.
|
|
1293
|
+
|
|
1294
|
+
Keyword Arguments:
|
|
1295
|
+
wheres {list} -- A list of values (default: {[]})
|
|
1296
|
+
|
|
1297
|
+
Returns:
|
|
1298
|
+
self
|
|
1299
|
+
"""
|
|
1300
|
+
pass
|
|
1301
|
+
|
|
1302
|
+
@classmethod
|
|
1303
|
+
def where_not_like(cls, column: str, value: str) -> QueryBuilder:
|
|
1304
|
+
"""Specifies a where expression.
|
|
1305
|
+
|
|
1306
|
+
Arguments:
|
|
1307
|
+
column {string} -- The name of the column to search
|
|
1308
|
+
value {string} -- The value of the column to match
|
|
1309
|
+
|
|
1310
|
+
Returns:
|
|
1311
|
+
self
|
|
1312
|
+
"""
|
|
1313
|
+
pass
|
|
1314
|
+
|
|
1315
|
+
@classmethod
|
|
1316
|
+
def where_not_null(cls, column: str) -> QueryBuilder:
|
|
1317
|
+
"""Specifies a where expression where the column is not NULL.
|
|
1318
|
+
|
|
1319
|
+
Arguments:
|
|
1320
|
+
column {string} -- The name of the column.
|
|
1321
|
+
|
|
1322
|
+
Returns:
|
|
1323
|
+
self
|
|
1324
|
+
"""
|
|
1325
|
+
pass
|
|
1326
|
+
|
|
1327
|
+
@classmethod
|
|
1328
|
+
def where_null(cls, column: str) -> QueryBuilder:
|
|
1329
|
+
"""Specifies a where expression where the column is NULL.
|
|
1330
|
+
|
|
1331
|
+
Arguments:
|
|
1332
|
+
column {string} -- The name of the column.
|
|
1333
|
+
|
|
1334
|
+
Returns:
|
|
1335
|
+
self
|
|
1336
|
+
"""
|
|
1337
|
+
pass
|
|
1338
|
+
|
|
1339
|
+
@classmethod
|
|
1340
|
+
def where_raw(cls, query: str, bindings: tuple = ()) -> QueryBuilder:
|
|
1341
|
+
"""Specifies raw SQL that should be injected into the where expression.
|
|
1342
|
+
|
|
1343
|
+
Arguments:
|
|
1344
|
+
query {string} -- The raw query string.
|
|
1345
|
+
|
|
1346
|
+
Keyword Arguments:
|
|
1347
|
+
bindings {tuple} -- query bindings that should be added to the connection. (default: {()})
|
|
1348
|
+
|
|
1349
|
+
Returns:
|
|
1350
|
+
self
|
|
1351
|
+
"""
|
|
1352
|
+
pass
|
|
1353
|
+
|
|
1354
|
+
@classmethod
|
|
1355
|
+
def with_(cls, *eagers: str | list | dict) -> QueryBuilder:
|
|
1356
|
+
pass
|
|
1357
|
+
|
|
1358
|
+
@classmethod
|
|
1359
|
+
def with_count(
|
|
1360
|
+
cls, relationship: str, callback: Any = None
|
|
1361
|
+
) -> QueryBuilder:
|
|
1362
|
+
pass
|
|
1363
|
+
|
|
1364
|
+
@classmethod
|
|
1365
|
+
def without_global_scopes(cls):
|
|
1366
|
+
pass
|