Model Class
Model Class
average()— Calculates the average value for a given property.columnDataForProperty()— Returns a struct with data for the named property.columnForProperty()— Returns the column name mapped for the named model property.columnNames()— Returns a list of column names in the table mapped to this model.columns()— Returns an array of columns names for the table associated with this class.count()— Returns the number of rows that match the arguments (or all rows if no arguments are passed in).create()— Creates a new object, saves it to the database (if the validation permits it), and returns it.deleteAll()— Deletes all records that match thewhereargument.deleteByKey()— Finds the record with the supplied key and deletes it.deleteOne()— Gets an object based on conditions and deletes it.exists()— Checks if a record exists in the table.findAll()— Returns records from the database table mapped to this model according to the arguments passed in (use thewhere</findAllKeys()— Returns all primary key values in a list.findByKey()— Fetches the requested record by primary key and returns it as an object.findFirst()— Fetches the first record ordered by primary key value.findLast()— Fetches the last record ordered by primary key value.findOne()— Fetches the first record found based on theWHEREandORDER BYclauses.getTableNamePrefix()— Returns the table name prefix set for the table.invokeWithTransaction()— Runs the specified method within a single database transaction.isClass()— Use this method to check whether you are currently in a class-level object.isInstance()— Use this method to check whether you are currently in an instance object.maximum()— Calculates the maximum value for a given property.minimum()— Calculates the minimum value for a given property.new()— Creates a new object based on suppliedpropertiesand returns it.onMissingMethod()— This method is not designed to be called directly from your code, but provides functionality for dynamic finders such asprimaryKey()— Returns the name of the primary key for this model’s table.primaryKeys()— Alias forprimaryKey().propertyNames()— Returns a list of property names ordered by their respective column’s ordinal position in the database table.save()— Saves the object if it passes validation and callbacks.sum()— Calculates the sum of values for a given property.tableName()— Returns the name of the database table that this model is mapped to.updateAll()— Updates all properties for the records that match thewhereargument.updateByKey()— Finds the object with the suppliedkeyand saves it (if validation permits it) with the suppliedpropupdateOne()— Gets an object based on the arguments used and updates it with the suppliedproperties.validationTypeForProperty()— Returns the validation type for the property.