sql_query_manager

Creator: coderz1093

Last updated:

0 purchases

sql_query_manager Image
sql_query_manager Images

Languages

Categories

Add to Cart

Description:

sql query manager

Dart package for data management in SQL databases, primarily intended for use with the sqflite package.
Features #
Make Consults with Data-Classes #
Make Inserts with automatic validations #
Getting started #
Creates classes that extend TableSql, in which you must specify the Table Instance, Create Form, and Edit Form.
class MyTable
extends TableSql<MyTable, MyTableCreationForm, MyTableEditionReplace> {
///The name of the table
@override
String get tableName => "name_of_my_table";

///Columns properties of the table
ColumnSql get localId => ColumnSql(
columnName: "local_id",
addedInVersion: 1,
dataType: SqlDataType.integer,
primaryKey: true,
autoIncrement: true);

ColumnSql get otherColumn => ColumnSql(
columnName: "other_column",
addedInVersion: 1,
dataType: SqlDataType.text,
notNull: true,
unique: true);

///This list is used for internal management of columns in the database
@override
List<ColumnSql> get columns => [localId, otherColumn];

///These will be the data that will be sent in the INSERT INTO
@override
Map<ColumnSql, dynamic> insertMap(final MyTableCreationForm creationForm) {
return {otherColumn: creationForm.dataOfOtherColumn};
}

///These will be the data that will be sent in the UPDATE
@override
Map<ColumnSql, dynamic> editMap(final MyTableEditionReplace editionForm) {
return {otherColumn: editionForm.dataOfOtherColumn};
}

///The instance must always reference itself (for internal use in development)
@override
get instance => this;
}
copied to clipboard
Usage #
Once you have the tables designed, you can start using them for the following purposes
Creation #
await MyTable().makeInsert(
database: database,
creationForm: MyTableCreationForm(dataOfOtherColumn: "Data"));
copied to clipboard
Visualization #
await database.rawQuery(MyTable().makeSelect());
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.