sqfentity 1.2.2+4 copy "sqfentity: ^1.2.2+4" to clipboard
sqfentity: ^1.2.2+4 copied to clipboard

outdated

SqfEntity ORM for Flutter/Dart lets you build and execute SQL commands easily and quickly with the help of fluent methods similar to .Net Entity Framework.

1.2.2+4 #

Added Form Generation Feature, and minValue, maxValue propery for datetime fields and fixed some bugs. Example:

@SqfEntityBuilderForm(tableCategory, formListTitleField: 'name', hasSubItems: true)
const tableCategory = SqfEntityTable(
    tableName: 'category',
    primaryKeyName: 'id',
    primaryKeyType: PrimaryKeyType.integer_auto_incremental,
    useSoftDeleting: true,
    // when useSoftDeleting is true, creates a field named 'isDeleted' on the table, and set to '1' this field when item deleted (does not hard delete)
    modelName:
        null, // SqfEntity will set it to TableName automatically when the modelName (class name) is null
    // declare fields
    fields: [
    SqfEntityField('name', DbType.text),
    SqfEntityField('isActive', DbType.bool, defaultValue: true),
    SqfEntityField('date1', DbType.datetime, defaultValue: 'DateTime.now()', minValue: '2019-01-01', maxValue: '2023-01-01'),
    SqfEntityField('date2', DbType.datetime,  minValue: '2020-01-01', maxValue: '2022-01-01')
    ]);

1.2.1 #

added saveResult property Note: You must re-generate your models after updating the package

Example:

final product = Product(
    name: 'Notebook 12"',
    description: '128 GB SSD i7',
    price: 6899,
    categoryId: 1);
await product.save();

print(product.saveResult.success); // bool (true/false)
print(product.saveResult.toString()); // String (message)

DEBUG CONSOLE output:

I/flutter: true
I/flutter: id=15 saved successfuly

1.2.0+13 #

bug fix: fixed error in convertDatabaseToModelBase()

1.2.0+8 #

added getDatabasePath() method example:

    final String dbPath = await MyDbModel().getDatabasePath();

1.2.0+6 #

When the application was initialize initializeDB() method is performed automatically in this version. You no longer need to call this method before start application

1.2.0+4 #

bug fix

1.2.0+2 #

added DateTime dbType

    SqfEntityField('birthDate', DbType.datetime),

added Date (Small Date) dbType

    SqfEntityField('birthDate', DbType.date),

1.2.0+1 #

modified dependencies (merged sqfentity_base with sqfentity_gen)

1.1.1+2 #

modified dependencies (removed sqfentity_gen, added sqfentity_base, downgrade path version to 1.6.2)

1.1.1 #

Added function to generate model from existing database

1.1.0+4 #

bug fix

1.1.0+2 #

implemented source_gen for model generate

1.0.5 #

fixed some bugs

1.0.4+1 #

added toJsonWithChilds() method

1.0.3 #

added toMapWithChilds() method

1.0.2 #

added toJson() method

final product = await Product().select().toSingle();
final jsonString = await product.toJson();

print("EXAMPLE 11.1 single object to Json\n product jsonString is: $jsonString");

final jsonStringWithChilds =  await Category().select().toJson(); // all categories selected
print("EXAMPLE 11.2 object list with nested objects to Json\n categories jsonString is: $jsonStringWithChilds");

1.0.1+3 #

added fromJson() method

1.0.0+1 #

Example of linking a column to a sequence

This is sample sequence in model

class SequenceIdentity extends SqfEntitySequence {
SequenceIdentity() {
    sequenceName = "identity";
    maxValue = 10;     /* optional. default is max int (9.223.372.036.854.775.807) */
    cycle = true;      /* optional. default is false; */
    //minValue = 0;    /* optional. default is 0 */
    //incrementBy = 1; /* optional. default is 1 */
    // startWith = 0;  /* optional. default is 0 */
    super.init();
}
static SequenceIdentity _instance;
static SequenceIdentity get getInstance {
    if (_instance == null) {
    _instance = SequenceIdentity();
    }
    return _instance;
}
}

How to linking a column to a sequence?

SqfEntityField("rownum", DbType.integer, sequencedBy: SequenceIdentity()

0.2.7+1 #

added some features and methods:

  • SEQUENCE Generator
  • dbModel.execScalar()

0.2.6 #

added String Primary Key Type WARNING: change the

primaryKeyType = PrimaryKeyType.integer_auto_incremental;

instead of

primaryKeyisIdentity = true

0.2.5+1 #

Fixed some bugs

0.2.4+1 #

New useful methods added dbModel.execSQL(sql), dbModel.execSQLList(sql) and dbModel.execDataTable(sql) see example at https://github.com/hhtokpinar/sqfEntity/blob/master/README.md#run-sql-raw-query-on-database-or-get-datatable

0.2.3 #

WARNING! toCount() return type (BoolResult) changed to (int)

0.2.2 #

startsWith(), endsWith() and contains() methods modified

0.2.1 #

optional parameter added to delete() method delete([bool hardDelete=false])

0.2.0 #

toListString() method added this method Returns List

0.1.0+22 #

dependencies modified

0.1.0+21 #

.fromWebUrl method modified

0.1.0+20 #

dependencies modified

0.1.0+18 #

recover() and delete() methods updated

0.1.0+13 #

create_model.dart modified

0.1.0+12 #

README.md and example/main.dart modified

0.1.0+11 #

README.md and example/main.dart modified

0.1.0+10 #

README.md and example/main.dart modified

0.1.0+9 #

README.md and example/main.dart modified

0.1.0+8 #

README.md and example/main.dart modified

0.1.0+7 #

README.md and example/main.dart modified

0.1.0+6 #

README.md modified

0.1.0+5 #

README.md modified

0.0.5+5 #

README.md modified

0.0.5+4 #

README.md modified

0.0.5+3 #

README.md modified

0.0.5+2 #

README.md modified

0.0.5+1 #

  • toList(), toSingle(), getById(), initializeDb(), fromWeb().. etc methods are replaced with async method

0.0.4+1 #

README.md modified

0.0.3+1 #

README.md modified

0.0.2+1 #

README.md modified

0.0.1 #

  • Initial experimentation
270
likes
0
pub points
90%
popularity

Publisher

verified publisherhuseyintokpinar.com

SqfEntity ORM for Flutter/Dart lets you build and execute SQL commands easily and quickly with the help of fluent methods similar to .Net Entity Framework.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, path, sqfentity_gen, sqflite, synchronized

More

Packages that depend on sqfentity