Properties
db
↔ Db
getter/setter pair
hashCode
→ int
The hash code for this object.
no setter inherited
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
Methods
appendTenantClause (String sql , List <String ? > values , {bool addWhere = false })
→ String
Is overriden by DaoTenant if this Dao is
a DaoTenant
callFromRow (Row row )
→ E
Used by DaoTenant to inject the tenant id
convertToDb (ValueList values )
→ List <String ? >
converts each value to a format suitable to
write to mysql.
delete ()
→ Delete<E >
fromResults (IResultSet results )
→ List <E >
fromRow (Row row )
→ E
fromRows (List <Row > rows )
→ Iterable <E >
getAll ()
→ Future <List <E > >
getByField (String fieldName , String fieldValue , {bool like = false })
→ Future <E >
getByFieldDate (String fieldName , DateTime fieldValue )
→ Future <E? >
getByFieldInt (String fieldName , int fieldValue )
→ Future <E? >
getById (int id )
→ Future <E >
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
.
getRowsByFieldInt (String fieldName , int fieldValue )
→ Future <List <E > >
getTablename ()
→ String
injectTenant (FieldList fields , List <String ? > values )
→ void
Overrride point for DaoTenant
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
persist (Entity <E > entity )
→ Future <int >
prepareInsert (FieldList fields , List <String ? > values )
→ void
override point for DaoTenant
query (String query , ValueList values )
→ Future <List <E > >
Allows you to write a custom query against the db.
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
.
querySingle (String query , ValueList values )
→ Future <E >
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.
remove (Entity <E > entity )
→ Future <void >
removeAll ()
→ Future <void >
removeById (int id )
→ Future <void >
select ()
→ Select<E >
toString ()
→ String
A string representation of this object.
inherited
tryByField (String fieldName , String fieldValue , {bool like = false })
→ Future <E? >
tryById (int id )
→ Future <E? >
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.
update (Entity <E > entity )
→ Future <void >
validate (String query )
→ void
If this Dao is a DaoTenant then the DaoTenant.validate
method will be called to check that multi-tenancy is being
enforced in the query.