DaoTenant<E extends EntityTenant<E>> class abstract

Inheritance

Constructors

DaoTenant(String tablename, {required String tenantFieldName})
DaoTenant.withDb(Db db, String tableName, {required String tenantFieldName})
Create a dao object with passed db

Properties

db Db
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tenantFieldName String
getter/setter pair

Methods

appendTenantClause(String sql, List<String?> values, {bool addWhere = false}) String
Is overriden by DaoTenant if this Dao is a DaoTenant
override
appendTenantValue(List<Object?> values) ValueList
appendTenantWhere(String sql, {bool addWhere = false}) String
callFromRow(Row row) → E
Used by DaoTenant to inject the tenant id
override
convertToDb(ValueList values) List<String?>
converts each value to a format suitable to write to mysql.
inherited
delete() → Delete<E>
inherited
fromResults(IResultSet results) List<E>
inherited
fromRow(Row row) → E
inherited
fromRows(List<Row> rows) Iterable<E>
inherited
getAll() Future<List<E>>
inherited
getByField(String fieldName, String fieldValue, {bool like = false}) Future<E>
inherited
getByFieldDate(String fieldName, DateTime fieldValue) Future<E?>
inherited
getByFieldInt(String fieldName, int fieldValue) Future<E?>
inherited
getById(int id) Future<E>
inherited
getListByField(String fieldName, String fieldValue, {bool like = false, int offset = 0, int limit = 20, String? orderBy, SortDirection sortDirection = SortDirection.asc}) Future<List<E>>
Perform a query with a where clause fieldName = fieldValue unles the like is true in which case we perform fieldName like fieldValue.
override
getRowsByFieldInt(String fieldName, int fieldValue) Future<List<E>>
inherited
getTablename() String
inherited
injectTenant(FieldList fields, List<String?> values) → void
Overrride point for DaoTenant
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
persist(Entity<E> entity) Future<int>
inherited
prepareInsert(FieldList fields, List<String?> values) → void
override point for DaoTenant
override
query(String query, ValueList values) Future<List<E>>
Allows you to write a custom query against the db.
inherited
queryColumn<S>(String query, ValueList values, String fieldName, S? convert(String value)) Future<S?>
use this to execute a query that returns a single row with a single column Its useful for 'sum' type queries. The fieldName to extract from the query. values to pass to the query convert a function to convert the return value (as a string) to S.
inherited
querySingle(String query, ValueList values) Future<E>
inherited
queryTenant(String _query, ValueList values) Future<List<E>>
Assumes that the last clause in query is a where clause and appends the tenant id if we are in tenant mode.
queryWithAdaptor<O>(String query, ValueList values, O adaptor(Row row)) Future<List<O>>
Allows you to write a custom query against the db providing an adaptor to convert the raw fields into a class instance.
inherited
remove(Entity<E> entity) Future<void>
inherited
removeAll() Future<void>
inherited
removeById(int id) Future<void>
inherited
select() → Select<E>
inherited
toString() String
A string representation of this object.
inherited
tryByField(String fieldName, String fieldValue, {bool like = false}) Future<E?>
inherited
tryById(int id) Future<E?>
inherited
trySingle(List<E> rows) Future<E?>
Expects rows to have zero or one elements. Throws TooManyResultsException if more than one row exists. Returns null if no rows exist.
inherited
update(Entity<E> entity) Future<void>
inherited
validate(String query) → void
Validates the multi-tenant has been configured correctly. Throws MissingTenantException if the tenant has been mis-configured.
override

Operators

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