-
Notifications
You must be signed in to change notification settings - Fork 0
Model
The base Model class for Mythix ORM. Every Mythix ORM model should inherit from this class. This class provides support for all model operations in Mythix ORM.
Notes:
- Many model methods have both static and instance
methods of the same name that do the same thing.
This is because it is common to access Model
methods directly on the model as well as an
instance. For example, Model is both
a static method, and an instance method. Nearly all
the methods listed here have both a
staticand and instance version. We are only listing thestaticversions because the instance versions generally will just be proxies to thesestaticmethods. - An underscore prefix on a method in Mythix ORM implies that this method should not be overloaded unless you know exactly what you are doing. It also implies that there is another method that can and should be overloaded instead.
This property assists with type checking.
method Model::_getConnection(connection?: Connection)
Arguments:
connection?: ConnectionAn optional connection that can be provided. If provided, it will simply be returned. Otherwise, if not provided, or a falsy value, then attempt to fallback to
modelInstance._connection, if that also fails to find a connection, the finally the method will call static _getConnection to get the bound connection, if any is available.Return value: Connection
Notes:
- Pay attention that unlike static _getConnection this checks the model's instance for
._connectionproperty. If that is a valid connection, then it will be returned before the bound connection. This is helpful when you have chosen not to bind a connection to your models. This will allow you to provide a connection directly when you create the model, which can make interacting with the model less tiresome. i.e.new Model(null, { connection }).
static method Model::_getConnection(connection?: Connection)
Get the underlying connection bound to the model's class. Connection binding is optional, so this method can also be provided a connection. If a connection is provided, then it will simply be returned. Because Mythix ORM has no globals, this is a design pattern to supply a connection if you have one available, or fallback to a "bound" connection (if one can be found).
Arguments:
connection?: ConnectionAn optional connection that can be provided. If provided, it will simply be returned. Otherwise, if not provided, or a falsy value, then attempt to fallback to the bound connection, if any is available.
Return value: Connection
Fetch all models from the database for this model type.
Arguments:
options?:objectAn "options" object to pass off to the underlying Connection methods. If a
connectionkey is specified in this object, then that will be used as the connection for the operation. This can be important if for example you are calling this from atransaction, in which case you most certainly would want to provide theconnectionfor the transaction. If astream: trueoption is provided, then an async generator will be returned, allowing you to "stream" the rows from the database in batches. The defaultbatchSizeis500, but can be overridden by setting thebatchSizeoption to some valid positive number, orInfinityto pull everything at once. If thestreamoption is not specified, or isfalse, then all rows will be fetched from the database in batches, collected into an array, and returned only once all rows have been fetched. This is the default behavior.Return value: Array<Model>
Return all models of this type from the database.
static method Model::bindConnection(connection?: Connection)
A Connection instance will call this method on a Model class to bind the model to the connection. Overload this to change the behavior of binding connections to models. This method should return a model class. The default behavior is to return
thisclass. However, you might return a different class for example if you generated a new class that inherited fromthisclass.Arguments:
connection?: ConnectionThe connection instance to bind to this model class.
Return value: class extends Model
Count the rows in the database for this model.
Arguments:
options?:objectAn "options" object to pass off to the underlying Connection methods. If a
connectionkey is specified in this object, then that will be used as the connection for the operation. This can be important if for example you are calling this from atransaction, in which case you most certainly would want to provide theconnectionfor the transaction.Return value:
numberReturn the number of models stored in the database for this model type.
static method Model::create(models: Array<Model> | Model | Array<object> | object, options?: object)
Create (insert) new models into the database. The
modelsargument can be a single model instance, a single object containing model attributes, an array of model instances, or an array of objects containing model attributes. This is a "bulk" create method, though it can be used to create a single model.Arguments:
models: Array<Model> | Model |Array<object>|objectSpecify the model(s) to create.
options?:objectAn "options" object to pass off to the underlying Connection methods. If a
connectionkey is specified in this object, then that will be used as the connection for the operation. This can be important if for example you are calling this from atransaction, in which case you most certainly would want to provide theconnectionfor the transaction.Return value: Model
Return the model instance(s) created.
static method Model::defaultScope(query: QueryEngine)
One can apply a "default scope" to any model simply by providing this static method on the model. By default it will simply return the QueryEngine instance (a query) that it was provided.
The way this works is simple. The caller provides the query as the first and only argument. The user, by overloading this method can then easily modify this provided query, changing the "default scope" whenever the model is used for queries. For example, let's say you have a User model, and by default, you only want to query against Users that have their
activecolumn set totrue. In order to do this, you could easily provide astatic defaultScopemethod on your model class that would modify the base query. See the following example:Examples:
class User extends Model { static defaultScope(baseQuery) { // `baseQuery` is equal to `User.where` // without a default scope. return baseQuery.active.EQ(true); } }Arguments:
query: QueryEngineThe query that you should add onto.
Return value: QueryEngine
Get the first (limit) rows from the database for this model type.
Arguments:
limit?:number(Default:1)The number of model instances to fetch from the database.
options?:objectAn "options" object to pass off to the underlying Connection methods. If a
connectionkey is specified in this object, then that will be used as the connection for the operation. This can be important if for example you are calling this from atransaction, in which case you most certainly would want to provide theconnectionfor the transaction.Return value: Model | Array<Model>
Return
limitmodels of this type from the database. Iflimitisnull,undefined, or1, then a single model instance will be returned (orundefinedif nothing is found). If thelimitargument is more than1, then an array of model instances will be returned, or an empty array if nothing is found.
Count the number of concrete fields on the model. "concrete" fields are non-virtual fields that are backed by the database. A
FOREIGN_KEYfield is a concrete field, soFOREIGN_KEYfields will be counted.Return value:
numberThe number of concrete fields the model has.
static method Model::getConnection(connection?: Connection)
Get the underlying connection bound to the model's class. Connection binding is optional, so this method can also be provided a connection. If a connection is provided, then it will simply be returned. Because Mythix ORM has no globals, this is a design pattern to supply a connection if you have one available, or fallback to a "bound" connection (if one can be found). This method should be overloaded if you wish to provide your own model specific connection.
Arguments:
connection?: ConnectionAn optional connection that can be provided. If provided, it will simply be returned. Otherwise, if not provided, or a falsy value, then attempt to fallback to the bound connection, if any is available.
Return value: Connection
Specify the default SELECT "ORDER" for the model. This method will be called if no "ORDER" was specified for any given query. This method should return an Array of fully qualified field names. The
optionsargument is the current options for the specific query being operated on.Arguments:
optionsReturn value:
Array<string>|nullAn array of fully qualified field names to specify the ORDER. Prefix a field name with
+to specify ASCending order, i.e.[ "+User:id" ]. Prefix the field name with-to specify DESCending order, i.e.[ "-User:id" ].Notes:
- Internally, Mythix ORM will call
this.connection.getDefaultOrder(options), which--if not overloaded--will simply call this method from the model itself.- A "fully qualified field name" in Mythix ORM means a full field definition, including the model name. An example of a fully qualified field name might be
"User:id". The model name is separated from the field name by a colon:. A short hand, not fully qualified field name example would be simply"id". Since this contains no model prefix, this is "short hand", and is not a fully qualified field name.
Get a specific model field by field name. This method will return
undefinedif the specified field can not be found on the model. This will find both concrete and virtual fields that are defined on the model.Arguments:
fieldName:stringThe specified field name to find. This is not the
columnNameof the field.Return value: Field
Notes:
- In Mythix ORM you never specify a field via its
columnName. You always use a field's definedfieldNameto match against a field. Using acolumnNamesimply won't work, unlesscolumnNameandfieldNamejust happen to have the same value.
Get the fields for this model. You can optionally specify the
fieldNamesargument, which will cause the method to return only the fields specified by name. If thefieldNamesargument is provided, then the return value will always be an array of fields. If thefieldNamesargument is not provided, then the return value could be either an Array of fields, or an object of fields, keyed by field name (depending on how you defined your model fields).Arguments:
fieldNames?:Array<string>An array of field names to fetch. If not provided then all model fields will be returned, including virtual fields.
Return value: Array<Field> | Object<string, Field>
Notes:
- The first time this method is called the model's fields will be built, and possibly modified. All fields will be turned into Field instances, and each field will be properly constructed to include required attributes, such as their parent
Model, theirfieldName, and theircolumnName. A model's fields are always initialized when the model is first bound to a connection, or when this method is first called.- In Mythix ORM you never specify a field via its
columnName. You always use a field's definedfieldNameto match against a field. Using acolumnNamesimply won't work, unlesscolumnNameandfieldNamejust happen to have the same value.
static method Model::getForeignKeyFieldsMap(connection?: Connection)
Return the foreign key relationships for the model.
Arguments:
connection?: ConnectionAn optional connection to pass through. This is needed if your models are not bound to a connection.
Return value:
Map<string, array<object>>The format is
Map[modelName] = [ { targetFieldName, sourceFieldName }, ... ]
static method Model::getForeignKeysTargetField(connection?: Connection, modelName: string, fieldName: string)
Get a specific foreign key field's relationship information. This will be what is stored in the relationship field map for the specified target field. See static getForeignKeyFieldsMap for more information.
Arguments:
connection?: ConnectionAn optional connection to pass through. This is needed if your models are not bound to a connection.
modelName:stringThe model name for which you wish to fetch foreign key fields from.
fieldName:stringThe field name for which you wish to fetch foreign key relational information about.
Return value:
object<{ targetFieldName, sourceFieldName }>This will be the relationship info for this foreign key field which will be an object of the shape
{ targetFieldName, sourceFieldName }.
static method Model::getForeignKeysTargetFieldNames(connection?: Connection, modelName: string)
Return all the foreign key target field names. This will return the target field names of all foreign key fields specified on the model.
Arguments:
connection?: ConnectionAn optional connection to pass through. This is needed if your models are not bound to a connection.
modelName:stringThe model name for which you wish to fetch foreign key fields from.
Return value:
Array<string>The format is
Array[] = modelName
static method Model::getForeignKeysTargetModelNames(connection?: Connection)
Return all the foreign key target model names. This will be all models targeted by all foreign keys defined by foreign key fields on this model. This will only return the models name's.
Arguments:
connection?: ConnectionAn optional connection to pass through. This is needed if your models are not bound to a connection.
Return value:
Array<string>The format is
Array[] = modelName
static method Model::getForeignKeysTargetModels(connection?: Connection)
Return all the foreign key target models. This will be all models targeted by all foreign keys defined by foreign key fields on this model.
Arguments:
connection?: ConnectionAn optional connection to pass through. This is needed if your models are not bound to a connection.
Return value:
Map<string, Model>The format is
Map[modelName] = Model
Get the Model class for this model.
Return value: class Model
Get the model name for this model. By default this will be the name of the class itself, i.e.
this.name. Overload this method to provide your own model name (singular name).Return value:
stringThe name the model.
Get the plural model name for this model. By default this will be the singular name of the model, converted to plural using the Inflection library. Overload this method to provide your own plural name for the model.
Return value:
stringThe name the model in plural form.
Notes:
- This will return the "plural" name of the model.
See also: static getSingularName
Get the primary key field of the model, if any is defined. If no primary key field is defined, then this will return
undefined. A primary key is specified per-model by usingprimaryKey: trueon one (and only one) of the model's fields.Return value: Field
Get the name of the primary key field of the model, if any is defined. If no primary key field is defined, then this will return
undefined. A primary key is specified per-model by usingprimaryKey: trueon one (and only one) of the model's fields.Return value:
string
static method Model::getQueryEngine(connection?: Connection, options?: object)
This method is called any time a
Model.whereorModel.$property is accessed. It returns a query, based off this model class (as the root model). It will first call static getUnscopedQueryEngine to get the root query for the model, and then it will call static defaultScope to apply any default scope to the root query. Finally, it will return the query to the user to start interacting with.Arguments:
connection?: ConnectionAn optional connection to pass through. This is needed if your models are not bound to a connection.
options?:objectAny extra options to pass to the QueryEngine constructor.
Return value: QueryEngine
static method Model::getQueryEngineClass(connection?: Connection)
This method is called every time a
Model.whereorModel.$property is accessed. It should return a class that inherits from (or is)QueryEngine. By default, it will callthis.getConnection().getQueryEngineClass()to get the query class defined in the connection options. Though this can be overloaded per-model (creating a different type ofQueryEngineper-model), theQueryEngineclass to instantiate to use for queries will generally be supplied by the connection.Arguments:
connection?: ConnectionAn optional connection to pass through. This is needed if your models are not bound to a connection.
Return value: class QueryEngine
Get the singular model name for this model. By default this will be the name of the class itself, i.e.
this.name. You should probably overload static getModelName to provide your own model name, instead of overloading this method.Return value:
stringThe name the model in singular form.
Notes:
- This will return the "singular" name of the model which is the same as static getModelName.
- This method simply calls static getModelName to get the singular model name.
See also: static getPluralModelName, static getModelName
This method is identical to static getFields except that it will always return an Array of fields, and the fields will always be sorted by their
fieldName.Arguments:
fieldNames?:Array<string>An array of field names to fetch. If not provided then all model fields will be returned, including virtual fields.
Return value: Array<Field>
Notes:
- In Mythix ORM you never specify a field via its
columnName. You always use a field's definedfieldNameto match against a field. Using acolumnNamesimply won't work, unlesscolumnNameandfieldNamejust happen to have the same value.
static method Model::getTableName(connection?: Connection)
Get the table name for this model. By default Mythix ORM will take the model's name, and convert it to snake_case.
Arguments:
connection?: ConnectionAn optional connection to pass through. This is needed if your models are not bound to a connection.
Return value:
stringThe name of the table for this model.
static method Model::getUnscopedQueryEngine(connection?: Connection, options?: object)
This method is called any time a
query.unscoped()call is made. It will return the query's "root class"wherewith no static defaultScope scope applied. Calling "unscoped()" will reset the query, so make sure you always call it first:Model.where.unscoped()...Arguments:
connection?: ConnectionAn optional connection to pass through. This is needed if your models are not bound to a connection.
options?:objectAny extra options to pass to the QueryEngine constructor.
Return value: QueryEngine
This method is called anytime a
Model.whereorModel.$attribute is accessed. It will provide the instantiated QueryEngine with the connection specified (if any). A connection can be specified for example by doingModel.where(connection)orModel.$(connection). This is generally only useful if you have chosen not to bind your models to a connection.Arguments:
options?:object { connection: Connection }An object, which if supplied, should contain a
connectionkey, specifying the connection. If no connection is provided, then this will fallback tothis.getConnection()to try and find the connection itself.Return value: QueryEngine
A QueryEngine instance (a query) for this model.
Check if the model has the specified field by name. If the specified field is found on the model, then return
true, otherwisefalsewill be returned.Arguments:
fieldName:stringThe specified field name to find. This is not the
columnNameof the field.Return value:
booleanNotes:
- In Mythix ORM you never specify a field via its
columnName. You always use a field's definedfieldNameto match against a field. Using acolumnNamesimply won't work, unlesscolumnNameandfieldNamejust happen to have the same value.
Check if any of the model's fields have a "remote value" as a
defaultValue. AdefaultValuemethod can itself report that it is "remote", meaning it is a value provided by the database itself. This method simply iterates all the model's fields, and callsfield.type.isRemote()on each field. Iffield.type.isRemote()returnstruefor any field, then this method will returntrue, otherwise it will returnfalse. Use this method to know if the model contains any fields whose value is obtained directly from the database itself (i.e. primary key date fields, etc...).Return value:
boolean
static method Model::initializeFields(fields: Array<Field> | Set<Field> | Object<string, Field> | Map<string, Field>)
Initialize all fields for the model. This will be called anytime a static getFields call is made. However, it caches its results, so it will immediately return if the model's fields have already been initialized.
This method does a number of things in the process of "initializing" model fields. It first ensures that every field is an instance of Field. Second, it ensures that the Type of the field is initialized (properly instantiated). Third, it ensures that all required attributes of each field is present. Required attributes are
Model(the parent model),fieldName(the name of this field), andcolumnName(the column name for the DB).columnName, if not provided, will simply becomefieldName.Arguments:
fields: Array<Field> | Set<Field> | Object<string, Field> | Map<string, Field>A list of fields to work off of. When this method is called by static getFields, then this argument will be
static Model.fields.Return value: Array<Field> | object<string, Field>
Notes:
- The cache for built fields is stored directly on the input
fieldsargument, under a non-enumerable_mythixFieldsInitializedcache key.
static method Model::isForeignKeyTargetModel(connection?: Connection, modelName: string)
Check if the specified model is a model pointed to by a foreign key field.
Arguments:
connection?: ConnectionAn optional connection to pass through. This is needed if your models are not bound to a connection.
modelName:stringThe model name for which you wish to fetch foreign key fields from.
Return value:
boolean
trueif the specifiedmodelNamemodel is pointed to by one of the foreign key fields,falseotherwise.
Check to see if the provided value is an instance of a Mythix ORM Model. Unlike static isModelClass, which checks if a class is a Model, this will check to see if an instance is an instance of a Mythix ORM Model. It will return
trueif the provided value is aninstanceofModel, or if the value'sconstructorproperty has a truthy_isMythixModelproperty (value.constructor._isMythixModel).Arguments:
value:anyValue to check.
Return value:
boolean
Use this method to check if a class is a Mythix ORM model. It will return
trueif the provided value is a class that inherits from Model, or if the provided value has an attribute named_isMythixModelthat is truthy.Arguments:
value:FunctionValue to check.
Return value:
boolean
static method Model::iterateFields(callback: Function(context: IterationContext), fields?: Array<Field> | Set<Field> | Object<string, Field> | Map<string, Field> = null, sorted?: boolean = false)
Iterate all model fields. This is a convenience method to iterate
static Model.fields, and is needed as the fields of a model can be anArray, anobject, aMap, or aSet. This method works a lot likeArray.prototype.map. Any return value from the providedcallbackwill be pushed into an array just likeArray.prototype.map. Thecallbackprovided, when called, will be provided acontextobject, as the single argument to the callback. This context object has the following shape:IterationContext = { // The Field instance itself. field, // The name of the field. fieldName, // All the model's fields. fields, // The current index into the list of fields. // This will be set even if the fields are // `object` or `Map` types. index, // A method that when called will halt // iteration and immediately return. stop, // A method that you can call to see // if `stop` has been called... meaning the // iteration process is about to halt. isStopped, }At any time you can call the
stopmethod provided via the context. When called,iterateFieldswill stop iterating, and immediately return an array of results returned by all calls tocallback.Arguments:
callback:Function(context: IterationContext)A callback method that will be called for every field on the model.
fields?: Array<Field> | Set<Field> | Object<string, Field> | Map<string, Field> (Default:null)An optional list of fields to use instead of
static Model.fields. This is handy if, for example, you want to iterate a sub-set of the model's fields, such as the "dirty" fields reported by the model.sorted?:boolean(Default:false)If
true, then sort the model fields before iterating. Iffalse, simply iterate the model's fields in their defined order.Return value:
Array<any>
Get the last (limit) rows from the database for this model type.
Arguments:
limit?:number(Default:1)The number of model instances to fetch from the database.
options?:objectAn "options" object to pass off to the underlying Connection methods. If a
connectionkey is specified in this object, then that will be used as the connection for the operation. This can be important if for example you are calling this from atransaction, in which case you most certainly would want to provide theconnectionfor the transaction.Return value: Model | Array<Model>
Return
limitmodels of this type from the database. Iflimitisnull,undefined, or1, then a single model instance will be returned (orundefinedif nothing is found). If thelimitargument is more than1, then an array of model instances will be returned, or an empty array if nothing is found.Notes:
- This works by telling the underlying query generator to invert the specified ORDER of the query, and then it selects the first
limitrows from the result.
static method Model::mergeFields(mergeFields?: Array<Field> | Set<Field> | Object<string, Field> | Map<string, Field>)
Merge specified fields into this model's fields. The
mergeFieldsargument is optional. If not provided, then this method will simply clone the model's fields. If specified, then the fields provided will be merged into the existing fields. Merging takes place based on each field'sfieldNameattribute. ThemergeFieldsargument can be anArray, anobject, aMap, or aSet. Fields are matched based onfieldName, but when a match is found, it is completely overridden by what is found in themergeFieldsargument. In short, the list of fields itself is merged, but the fields themselves are not merged (a shallow merge). All input objects that have keys (Object<string, Field> | Map<string, Field>) must specify thefieldNameof the field as the key. If the input is an Array type (Array<Field> | Set<Field>) then each field must contain afieldNameattribute, or an exception will be thrown.</string,></string,>.Arguments:
mergeFields?: Array<Field> | Set<Field> | Object<string, Field> | Map<string, Field>A list of fields to merge into the current model fields. The field list, as well as all fields will be cloned.
Return value: Array<Field> | object<string, Field>
Notes:
Pluck specific fields (columns) from the database for this model type.
Arguments:
fields?:Array<string>An array of fully qualified field names to pluck from the underlying database table for this model. Do not use column names here... these must be fully qualified field names.
options?:objectAn "options" object to pass off to the underlying Connection methods. If a
connectionkey is specified in this object, then that will be used as the connection for the operation. This can be important if for example you are calling this from atransaction, in which case you most certainly would want to provide theconnectionfor the transaction.Return value:
Array<any>|Array<Array<any>>If only a single field is specified, then a flat array of values will be returned across all rows. If more than one field is specified, then an array of arrays (rows) will be returned for the fields specified.
Notes:
- In Mythix ORM you never specify a field via its
columnName. You always use a field's definedfieldNameto match against a field. Using acolumnNamesimply won't work, unlesscolumnNameandfieldNamejust happen to have the same value.
Check to see if the primary key field (if any is defined) has a "remote" default value. For example, an autoincrementing primary key field would return
truefrom this method, because an autoincrementing field value is retrieved directly from the database. This could returnfalse, if for example, you were using UUIDs, or XIDs for your primary key.Return value:
boolean
trueif the primary key field of the model has a "remote"defaultValue,falseotherwise. Remoteness is checked viathis.getPrimaryKeyField().type.isRemote().
Like everywhere in Javascript, we can call
.toString()to a get a string representation of our Model class. The optionalshowFieldsargument, if true, will list the models fields as well. Without theshowFieldsargument, the model name alone will be returned as a string.Arguments:
showFields?:booleanIf
true, then list the models fields.Return value:
string
- Associations
- Certifications
- Connection Binding
- Home
- Models
- Queries
- TypeScript
- Types Reference
-
namespace AsyncStore
- function getContextStore
- function getContextValue
- function runInContext
- function setContextValue
-
namespace Helpers
- function checkDefaultValueFlags
- function defaultValueFlags
- function getDefaultValueFlags
- property FLAG_LITERAL
- property FLAG_ON_INITIALIZE
- property FLAG_ON_INSERT
- property FLAG_ON_STORE
- property FLAG_ON_UPDATE
- property FLAG_REMOTE
-
namespace MiscUtils
- function collect
- function valueToDateTime
-
namespace ModelUtils
- function parseQualifiedName
-
namespace QueryUtils
- function generateQueryFromFilter
- function mergeFields
- function parseFilterFieldAndOperator
-
class AverageLiteral
- method static isAggregate
- method toString
-
class BigIntType
- property Default
- method castToType
- method constructor
- method isValidValue
- method static getDisplayName
- method toString
-
class BlobType
- method castToType
- method constructor
- method isValidValue
- method static getDisplayName
- method toString
-
class BooleanType
- method castToType
- method isValidValue
- method static getDisplayName
- method toString
-
class CacheKey
- method constructor
- method valueOf
-
class CharType
- method castToType
- method isValidValue
- method static getDisplayName
- method toString
-
class ConnectionBase
- property _isMythixConnection
- property DefaultQueryGenerator
- property dialect
- property Literals
- method _averageLiteralToString
- method _bigintTypeToString
- method _blobTypeToString
- method _booleanTypeToString
- method _charTypeToString
- method _countLiteralToString
- method _datetimeTypeToString
- method _dateTypeToString
- method _distinctLiteralToString
- method _escape
- method _escapeID
- method _fieldLiteralToString
- method _getFromModelCache
- method _integerTypeToString
- method _maxLiteralToString
- method _minLiteralToString
- method _numericTypeToString
- method _realTypeToString
- method _setToModelCache
- method _stringTypeToString
- method _sumLiteralToString
- method _textTypeToString
- method _uuidV1TypeToString
- method _uuidV3TypeToString
- method _uuidV4TypeToString
- method _uuidV5TypeToString
- method _xidTypeToString
- method addColumn
- method addIndex
- method aggregate
- method alterColumn
- method alterTable
- method average
- method buildConnectionContext
- method bulkModelOperation
- method constructor
- method convertDateToDBTime
- method count
- method createContext
- method createQueryGenerator
- method createTable
- method createTables
- method destroy
- method destroyModels
- method dirtyFieldHelper
- method dropColumn
- method dropIndex
- method dropTable
- method dropTables
- method ensureAllModelsAreInstances
- method escape
- method escapeID
- method exists
- method finalizeQuery
- method findModelField
- method getContextValue
- method getDefaultFieldValue
- method getDefaultOrder
- method getField
- method getLockMode
- method getModel
- method getModels
- method getOptions
- method getQueryEngineClass
- method getQueryGenerator
- method insert
- method isStarted
- method literalToString
- method max
- method min
- method parseQualifiedName
- method pluck
- method prepareAllModelsAndSubModelsForOperation
- method prepareAllModelsForOperation
- method query
- method registerModel
- method registerModels
- method runSaveHooks
- method select
- method setContextValue
- method setPersisted
- method setQueryGenerator
- method splitModelAndSubModels
- method stackAssign
- method start
- method static getLiteralClassByName
- method static isConnection
- method static isConnectionClass
- method static Literal
- method stop
- method sum
- method toQueryEngine
- method transaction
- method truncate
- method typeToString
- method update
- method updateAll
- method upsert
-
class CountLiteral
- method static isAggregate
- method static isFieldRequired
- method toString
-
class DateTimeType
- property Default
- method castToType
- method constructor
- method deserialize
- method isValidValue
- method serialize
- method static getDisplayName
- method toString
-
class DateType
- property Default
- method castToType
- method constructor
- method deserialize
- method isValidValue
- method serialize
- method static getDisplayName
- method toString
-
class DistinctLiteral
- method toString
-
class Field
- property _isMythixField
- property allowNull
- property defaultValue
- property fieldName
- property get
- property index
- property primaryKey
- property set
- property type
- property unique
- property validate
- method clone
- method constructor
- method setModel
- method static isField
- method static isFieldClass
-
class FieldLiteral
- method toString
- class FieldScope
-
class ForeignKeyType
- method castToType
- method constructor
- method getOptions
- method getTargetField
- method getTargetFieldName
- method getTargetModel
- method getTargetModelName
- method initialize
- method isValidValue
- method parseOptionsAndCheckForErrors
- method static getDisplayName
- method static isForeignKey
- method toString
-
class IntegerType
- property Default
- method castToType
- method constructor
- method isValidValue
- method static getDisplayName
- method toString
-
class Literal
- method constructor
-
class LiteralBase
- property _isMythixLiteral
- method constructor
- method definitionToField
- method fullyQualifiedNameToDefinition
- method static isAggregate
- method static isLiteral
- method static isLiteralClass
- method static isLiteralType
- method toString
- method valueOf
-
class LiteralFieldBase
- method constructor
- method getField
- method getFullyQualifiedFieldName
- method static isFieldRequired
- method valueOf
-
class MaxLiteral
- method static isAggregate
- method toString
-
class MinLiteral
- method static isAggregate
- method toString
-
class Model
- property _isMythixModel
- method _castFieldValue
- method _constructField
- method _constructFields
- method _constructor
- method _getConnection
- method _getDirtyFields
- method _getFieldValue
- method _initializeFieldData
- method _initializeModelData
- method _setFieldValue
- method clearDirty
- method constructor
- method destroy
- method getAttributes
- method getConnection
- method getDataValue
- method getDirtyFields
- method getOptions
- method hasValidPrimaryKey
- method isDirty
- method isPersisted
- method onAfterCreate
- method onAfterSave
- method onAfterUpdate
- method onBeforeCreate
- method onBeforeSave
- method onBeforeUpdate
- method onValidate
- method reload
- method save
- method setAttributes
- method setDataValue
- method static _getConnection
- method static all
- method static bindConnection
- method static count
- method static create
- method static cursor
- method static defaultScope
- method static finalizeQuery
- method static first
- method static getConcreteFieldCount
- method static getContextValue
- method static getField
- method static getFields
- method static getForeignKeyFieldsMap
- method static getForeignKeysTargetField
- method static getForeignKeysTargetFieldNames
- method static getForeignKeysTargetModelNames
- method static getForeignKeysTargetModels
- method static getModel
- method static getModelContext
- method static getModelName
- method static getPluralModelName
- method static getPrimaryKeyField
- method static getPrimaryKeyFieldName
- method static getQueryEngine
- method static getQueryEngineClass
- method static getSingularName
- method static getSortedFields
- method static getTableName
- method static getUnscopedQueryEngine
- method static getWhereWithConnection
- method static hasField
- method static hasRemoteFieldValues
- method static initializeFields
- method static isForeignKeyTargetModel
- method static isModel
- method static isModelClass
- method static iterateFields
- method static last
- method static mergeFields
- method static pluck
- method static primaryKeyHasRemoteValue
- method static setContextValue
- method static toString
- method static updateModelContext
- method toJSON
- method toString
- method updateDirtyID
-
class ModelScope
- method _getField
- method AND
- method CROSS_JOIN
- method DISTINCT
- method EXISTS
- method Field
- method FULL_JOIN
- method GROUP_BY
- method HAVING
- method INNER_JOIN
- method JOIN
- method LEFT_JOIN
- method LIMIT
- method mergeFields
- method NOT
- method OFFSET
- method OR
- method ORDER
- method PROJECT
- method RIGHT_JOIN
-
class ModelType
- method fieldNameToOperationName
- method initialize
-
class ModelsType
- method fieldNameToOperationName
- method initialize
-
class NumericType
- method castToType
- method constructor
- method isValidValue
- method static getDisplayName
- method toString
-
class ProxyClass
- property APPLY
- property AUTO_CALL
- property AUTO_CALL_CALLED
- property AUTO_CALL_CALLER
- property CALLABLE
- property CONSTRUCT
- property DEFINE_PROPERTY
- property DELETE_PROPERTY
- property GET
- property GET_OWN_PROPERTY_DESCRIPTOR
- property GET_PROTOTYPEOF
- property HAS
- property IS_EXTENSIBLE
- property MISSING
- property OWN_KEYS
- property PREVENT_EXTENSIONS
- property PROXY
- property SELF
- property SET
- property SET_PROTOTYPEOF
- property shouldSkipProxy
- property TARGET
- method ___autoCall
- method ___call
- method constructor
-
class QueryEngine
- method all
- method average
- method constructor
- method count
- method cursor
- method destroy
- method exists
- method finalizeQuery
- method first
- method getFieldScopeClass
- method getModelScopeClass
- method last
- method max
- method MERGE
- method min
- method Model
- method pluck
- method sum
- method toString
- method unscoped
- method updateAll
-
class QueryEngineBase
- method _fetchScope
- method _inheritContext
- method _newFieldScope
- method _newModelScope
- method _newQueryEngineScope
- method _pushOperationOntoStack
- method clone
- method constructor
- method filter
- method getAllModelsUsedInQuery
- method getConnection
- method getFieldScopeClass
- method getModel
- method getModelScopeClass
- method getOperationContext
- method getOperationStack
- method getQueryEngineClass
- method getQueryEngineScope
- method getQueryEngineScopeClass
- method getQueryID
- method isLastOperationCondition
- method isLastOperationControl
- method isModelUsedInQuery
- method logQueryOperations
- method map
- method queryHasConditions
- method queryHasJoins
- method static generateID
- method static getQueryOperationInfo
- method static isQuery
- method static isQueryOperationContext
- method walk
-
class QueryGeneratorBase
- method _averageLiteralToString
- method _countLiteralToString
- method _distinctLiteralToString
- method _fieldLiteralToString
- method _maxLiteralToString
- method _minLiteralToString
- method _sumLiteralToString
- method constructor
- method escape
- method escapeID
- method getConnection
- method getFieldDefaultValue
- method getIndexFieldsFromFieldIndex
- method setConnection
- method stackAssign
- method toConnectionString
-
class RealType
- method castToType
- method constructor
- method isValidValue
- method static getDisplayName
- method toString
-
class SerializedType
- method castToType
- method constructor
- method deserialize
- method getOptions
- method initialize
- method isDirty
- method isValidValue
- method onSetFieldValue
- method serialize
- method static getDisplayName
- method toString
-
class StringType
- method castToType
- method constructor
- method isValidValue
- method static getDisplayName
- method toString
-
class SumLiteral
- method static isAggregate
- method toString
-
class TextType
- method castToType
- method constructor
- method isValidValue
- method static getDisplayName
- method toString
-
class Type
- property _isMythixFieldType
- property clone
- method castToType
- method clone
- method constructor
- method deserialize
- method exposeToModel
- method getDisplayName
- method getField
- method getModel
- method initialize
- method isDirty
- method isForeignKey
- method isRelational
- method isRemote
- method isValidValue
- method isVirtual
- method onSetFieldValue
- method serialize
- method setField
- method setModel
- method static instantiateType
- method static isSameType
- method static isType
- method static isTypeClass
- method static wrapConstructor
- method toConnectionType
-
class UUIDV1Type
- property Default
- method castToType
- method getArgsForUUID
- method isValidValue
- method static getDisplayName
- method validateOptions
-
class UUIDV3Type
- property Default
- method castToType
- method getArgsForUUID
- method isValidValue
- method static getDisplayName
- method validateOptions
-
class UUIDV4Type
- property Default
- method castToType
- method getArgsForUUID
- method isValidValue
- method static getDisplayName
- method validateOptions
-
class UUIDV5Type
- property Default
- method castToType
- method getArgsForUUID
- method isValidValue
- method static getDisplayName
- method validateOptions
-
class XIDType
- property Default
- method castToType
- method isValidValue
- method static getDisplayName