Skip to content
New issue

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

can't generate code #235

Closed
careylee0127 opened this issue Jan 20, 2020 · 1 comment
Closed

can't generate code #235

careylee0127 opened this issue Jan 20, 2020 · 1 comment

Comments

@careylee0127
Copy link

careylee0127 commented Jan 20, 2020

Here is my code;
@entity
class Step {
@PrimaryKey
int date;
int step;
int cal;

Step(this.date, this.step, this.cal);
}

@dao
abstract class StepDao {
@query("SELECT * FROM Step")
Future<List> all();

@query("SELECT * FROM Step WHERE id = :id")
Future getById(int id);

@query(
"SELECT sum(step),sum(cal),date FROM Step WHERE date >= :begin and date <= :end GROUP BY strftime('%Y-%m-%d %H',date) ORDER BY date")
Future<List> getDaySteps(int begin, int end);

@query(
"SELECT sum(step),sum(cal),date FROM Step WHERE date>=:begin and date<=:end GROUP BY strftime('%Y-%m-%d',date) ORDER BY date")
Future<List> getWeekSteps(int begin, int end);

@query(
"SELECT sum(step),sum(cal),date FROM Step WHERE date >= :begin and date <= :end GROUP BY strftime('%Y-%m-%d',date) ORDER BY date")
Future<List> getMonthSteps(int begin, int end);

@insert
Future save(Step entity);
}

floor version: floor: ^0.9.0

When I run build_runner ,catch error here:
Error formatting generated source code for package:squirrel/data/db/squirrel_band_database.dartwhich was output to lib/data/db/squirrel_band_database.floor.g.part.
This may indicate an issue in the generated code or in the formatter.
Please check the generated code and file an issue on source_gen if appropriate.
Could not format because the source could not be parsed:

line 89, column 196: Expected an identifier.

89 │ @OverRide Future<List> getDaySteps(int begin, int end) async { return _queryAdapter.queryList('SELECT sum(step),sum(cal),date FROM Step WHERE date >= ? and date <= ? GROUP BY strftime('%Y-%m-%d %H',date) ORDER BY date', arguments: [begin, end], mapper: _stepMapper); }
│ ^

line 89, column 199: Expected an identifier.

89 │ @OverRide Future<List> getDaySteps(int begin, int end) async { return _queryAdapter.queryList('SELECT sum(step),sum(cal),date FROM Step WHERE date >= ? and date <= ? GROUP BY strftime('%Y-%m-%d %H',date) ORDER BY date', arguments: [begin, end], mapper: _stepMapper); }
│ ^

line 89, column 204: Expected to find ','.

89 │ @OverRide Future<List> getDaySteps(int begin, int end) async { return _queryAdapter.queryList('SELECT sum(step),sum(cal),date FROM Step WHERE date >= ? and date <= ? GROUP BY strftime('%Y-%m-%d %H',date) ORDER BY date', arguments: [begin, end], mapper: _stepMapper); }
│ ^^^^^^^^^^^^^^^^^^^^^^

line 90, column 193: Expected an identifier.

90 │ @OverRide Future<List> getWeekSteps(int begin, int end) async { return _queryAdapter.queryList('SELECT sum(step),sum(cal),date FROM Step WHERE date>=? and date<=? GROUP BY strftime('%Y-%m-%d',date) ORDER BY date', arguments: [begin, end], mapper: _stepMapper); }
│ ^

line 90, column 196: Expected an identifier.

90 │ @OverRide Future<List> getWeekSteps(int begin, int end) async { return _queryAdapter.queryList('SELECT sum(step),sum(cal),date FROM Step WHERE date>=? and date<=? GROUP BY strftime('%Y-%m-%d',date) ORDER BY date', arguments: [begin, end], mapper: _stepMapper); }
│ ^

line 90, column 198: Expected to find ','.

90 │ @OverRide Future<List> getWeekSteps(int begin, int end) async { return _queryAdapter.queryList('SELECT sum(step),sum(cal),date FROM Step WHERE date>=? and date<=? GROUP BY strftime('%Y-%m-%d',date) ORDER BY date', arguments: [begin, end], mapper: _stepMapper); }
│ ^^^^^^^^^^^^^^^^^^^^^^

line 91, column 198: Expected an identifier.

91 │ @OverRide Future<List> getMonthSteps(int begin, int end) async { return _queryAdapter.queryList('SELECT sum(step),sum(cal),date FROM Step WHERE date >= ? and date <= ? GROUP BY strftime('%Y-%m-%d',date) ORDER BY date', arguments: [begin, end], mapper: _stepMapper); }
│ ^

line 91, column 201: Expected an identifier.

91 │ @OverRide Future<List> getMonthSteps(int begin, int end) async { return _queryAdapter.queryList('SELECT sum(step),sum(cal),date FROM Step WHERE date >= ? and date <= ? GROUP BY strftime('%Y-%m-%d',date) ORDER BY date', arguments: [begin, end], mapper: _stepMapper); }
│ ^

line 91, column 203: Expected to find ','.

91 │ @OverRide Future<List> getMonthSteps(int begin, int end) async { return _queryAdapter.queryList('SELECT sum(step),sum(cal),date FROM Step WHERE date >= ? and date <= ? GROUP BY strftime('%Y-%m-%d',date) ORDER BY date', arguments: [begin, end], mapper: _stepMapper); }
│ ^^^^^^^^^^^^^^^^^^^^^^

[INFO] Running build completed, took 3.4s

[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 87ms

[SEVERE] Failed after 3.5s
pub finished with exit code 1

@careylee0127
Copy link
Author

I'm solved it

@dao
abstract class StepDao {
@query("SELECT * FROM Step")
Future<List> all();

@query("SELECT * FROM Step WHERE id = :id")
Future getById(int id);

@query(
"SELECT sum(step),sum(cal),date FROM Step WHERE date >= :begin and date <= :end GROUP BY strftime(\'%Y-%m-%d %H\',date) ORDER BY date")
Future<List> getDaySteps(int begin, int end);

@query(
"SELECT sum(step),sum(cal),date FROM Step WHERE date>=:begin and date<=:end GROUP BY strftime(\'%Y-%m-%d\',date) ORDER BY date")
Future<List> getWeekSteps(int begin, int end);

@query(
"SELECT sum(step),sum(cal),date FROM Step WHERE date >= :begin and date <= :end GROUP BY strftime(\'%Y-%m-%d\',date) ORDER BY date")
Future<List> getMonthSteps(int begin, int end);

@insert
Future save(Step entity);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant