QField class

Represents a database field or column with proper SQL quoting and optional aliasing.

The QField class handles field names with proper backtick quoting for MySQL and supports table.field notation as well as aliasing.

Example usage:

var field1 = QField('name'); // `name`
var field2 = QField('users.email'); // `users`.`email`
var field3 = QField('count', as: 'total'); // `count` AS `total`
Inheritance

Constructors

QField.new(String field, {String as = '', bool distinct = false})
Creates a database field with optional alias.

Properties

as String
Optional alias for the field
getter/setter pair
distinct bool
Whether to select distinct values for this field
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value ↔ dynamic
The Dart value to be converted to SQL
getter/setter pairinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toSQL() String
Generates the SQL representation with proper quoting and aliasing.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

id() QField
Convenience method to create a field representing an 'id' column.