We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Table declaration:
const SqfEntityTable tableAgeGroup = SqfEntityTable( tableName: 'ageGroup', primaryKeyName: 'id', primaryKeyType: PrimaryKeyType.integer_auto_incremental, useSoftDeleting: false, fields: [ SqfEntityField( 'minAge', DbType.integer, isUnique: true, isNotNull: true, ), SqfEntityField( 'maxAge', DbType.integer, isUnique: true, isNotNull: true, ), SqfEntityField( 'label', DbType.text, isUnique: true, isNotNull: true, ), ], );
Test & output:
var model1 = AgeGroup.withFields(1, 2, "1 to 2"); await model1.save(); print(model1.saveResult); // ageGroup-> id=1 saved successfully var model2 = AgeGroup.withFields(1, 2, "1 to 2"); await model2.save(); print(model2.saveResult); // ageGroup-> Save failed. Error: DatabaseException(error code 19: UNIQUE constraint failed: ageGroup.label) sql 'INSERT INTO ageGroup (id, minAge, maxAge, label) VALUES (NULL, ?, ?, ?)' args [1, 2, 1 to 2] var model3 = AgeGroup.withFields(1, 5, "1 to 5"); await model3.save(); print(model3.saveResult); // ageGroup-> Save failed. Error: DatabaseException(error code 19: UNIQUE constraint failed: ageGroup.minAge) sql 'INSERT INTO ageGroup (id, minAge, maxAge, label) VALUES (NULL, ?, ?, ?)' args [1, 5, 1 to 5]
I have tried using isIndexGroup, but the output of model3 indicated that it doesn't work. Probably isIndexGroup is designed only for index grouping.
isIndexGroup
model3
Request:
isUniqueGroup
The text was updated successfully, but these errors were encountered:
it seems like it has been addressed in #128 I just can't get where should I put the isPrimarykey parameter?
isPrimarykey
Sorry, something went wrong.
You could remove the primary key id, and just add isPrimaryKey parameters into other keys instead of isUnique like below
SqfEntityField( 'maxAge', DbType.integer, isPrimaryKey: true, isNotNull: true, ),
No branches or pull requests
Table declaration:
Test & output:
I have tried using
isIndexGroup
, but the output ofmodel3
indicated that it doesn't work. ProbablyisIndexGroup
is designed only for index grouping.Request:
isUniqueGroup
parameter (like theisIndexGroup
) or similar parameter name.The text was updated successfully, but these errors were encountered: