Commit Graph

351 Commits

Author SHA1 Message Date
Simon Binder c69b7cb283
Move builders and analyzer plugin into subfolder 2019-12-14 21:49:51 +01:00
Simon Binder 8661e0a28a
Refactoring on the model classes in moor_generator 2019-12-14 21:43:04 +01:00
Simon Binder f30f6f6b9b
Ignore warning for analyzer src import 2019-12-13 22:31:24 +01:00
Simon Binder c9f29fab5b
Support detailed analysis for fts5 functions 2019-12-13 22:30:36 +01:00
Simon Binder 94634bd48b
Support custom fts5 queries 2019-12-12 18:56:37 +01:00
Simon Binder da9ca61e0c
Don't remap tables from sql -> moor -> sql 2019-12-12 18:06:56 +01:00
Simon Binder cf607f0108
Escape column names during insert 2019-12-12 09:23:41 +01:00
Simon Binder a23ff772fa
Improve syntax highlighting in the sql IDE 2019-12-11 21:14:33 +01:00
Simon Binder bdea374fa2
Generator: Extract writer into a top-level library 2019-12-11 10:44:28 +01:00
Simon Binder 2c97373bdd
Support implicit-dynamic: false
Closes #268
2019-12-10 20:38:08 +01:00
Simon Binder 74ebb8a9ab
Ability to create fts5 tables in moor files (#196) 2019-12-10 20:24:08 +01:00
Simon Binder 40eaf17a7d
Generator tests: Always provide task and file for a step 2019-12-07 17:53:53 +01:00
Simon Binder 028d5558f5
Fix alias typo when generating table classes 2019-12-07 09:29:18 +01:00
Simon Binder 28b1e19145
Test that dart components can be used from UseMoor/Dao
Fixes #267
2019-12-05 19:23:52 +01:00
Simon Binder 3c74a20f56
Enable more recent lints and enforce them 2019-12-04 21:45:09 +01:00
Simon Binder 092f64d7cf
Escape column names during insert 2019-12-02 21:40:41 +01:00
Simon Binder a0ce3421c9
Resolve json functions when option is set (#235) 2019-11-28 21:50:55 +01:00
Simon Binder 8320ddc788
Make modules configurable via a build option 2019-11-28 20:46:42 +01:00
Simon Binder 9e7e6d0922
Use json_serializable for the build options 2019-11-28 20:34:07 +01:00
Simon Binder 75d4463085
Use same generator session in same build step 2019-11-28 20:14:08 +01:00
Simon Binder 68b516fff4
Fix analyzer crash at CTE (#255) 2019-11-24 21:21:32 +01:00
Simon Binder 6fb57ca53f
Disable our own caching algorithm across build steps 2019-11-24 21:20:55 +01:00
Simon Binder bb1fcc1590
Fix analyzer crash at CTE (#255) 2019-11-24 14:46:20 +01:00
Simon Binder a1f9e7ce13
Disable our own caching algorithm across build steps 2019-11-20 11:51:38 +01:00
Simon Binder 8819245685
Resolve Dart expressions in moor files 2019-11-18 13:59:10 +01:00
Simon Binder 598fef750e
RELEASE
- moor 2.1.0
- moor_generator 2.1.0
- sqlparser 0.4.0
- moor_ffi 0.2.0
2019-11-16 11:23:11 +01:00
Simon Binder 98470109cf
Remove built_value(_generator) dependency from generator 2019-11-04 17:09:21 +01:00
Simon Binder 5cc1f85441
Inject mock streams via .connect constructor 2019-10-30 19:25:26 +01:00
Simon Binder bf1e174ca3
Formally support analyzer 0.40.0
It looks like we don't use any of the removed APIs, but that's hard to verify because most of our dependencies don't support analyzer 0.40.0 yet.
2019-10-27 10:46:29 +01:00
Simon Binder 45a8d8fbb3
IDE: Add navigation support for more types of columns 2019-10-24 20:41:58 +02:00
Simon Binder 8a54fd4729
Generate code for CREATE TRIGGER statements 2019-10-21 18:13:28 +02:00
Simon Binder a69f469444
Support sqlite_master, sqlite_sequence tables (#197) 2019-10-19 16:56:36 +02:00
Simon Binder fd27c878d4
Fix errors in sqlparser that were swallowed before 2019-10-19 16:41:30 +02:00
Simon Binder 263004fe7b
Option to use the column name as json key in moor files
Closes #176
2019-10-17 21:44:20 +02:00
Simon Binder 95f37575f8
Optionally use data class name for companions
Closes #185
2019-10-16 21:33:13 +02:00
Simon Binder 4c090af98c
Ability to override json keys in moor files (#176) 2019-10-14 19:59:52 +02:00
Simon Binder 0b9d4c897b
Properly handle overridden elements when parsing columns 2019-10-11 18:00:17 +02:00
Simon Binder 337e260667
Support inheritance in table definitions (#169) 2019-10-11 17:43:48 +02:00
Simon Binder 5510a90583
Fix warnings (2.6-dev SDK), escape \r, constant workaround 2019-10-09 19:48:52 +02:00
Simon Binder 6e32e37dd7
Remove unnecessary type parameter on createCompanion 2019-10-05 22:41:23 +02:00
Simon Binder 718af051ff
Optionally disable verification code (#173) 2019-10-05 21:41:20 +02:00
Simon Binder ed03bff4c2
Recognize boolean and datetime column in moor 2019-10-05 21:24:41 +02:00
Simon Binder 1ba687696f
Plugin: Navigation support for table references 2019-09-28 23:15:23 +02:00
Simon Binder d91c69493f
Plugin: Navigation for column references in queries 2019-09-28 22:24:40 +02:00
Simon Binder b9f934c1d4
Report information about where a column was declared 2019-09-28 22:01:28 +02:00
Simon Binder 12a6c45a42
Plugin: Fix deadlock when analyzing Dart imports in .moor 2019-09-28 19:21:03 +02:00
Simon Binder 1fc9ccb3cc
Plugin: Report navigation targets for import statements 2019-09-27 23:15:08 +02:00
Simon Binder ab787b82be
Use existing parser code for auto-complete
This works very well when the user is typing at the end of a statement, but won't provide accurate results when editing in the middle.
2019-09-27 22:06:14 +02:00
Simon Binder a6cfc5fdd8
Better types for nested expressions, more 2.0 docs 2019-09-26 22:46:19 +02:00
Simon Binder fb68dc0888
Introduce option to generate less query code 2019-09-25 20:01:16 +02:00
Simon Binder 0cbac2ee37
Parse compound select statements 2019-09-25 14:58:44 +02:00
Simon Binder ba21a594af
Fix autocomplete and suggestions in the analyzer plugin 2019-09-24 20:50:23 +02:00
Simon Binder 7d962a1f01
Fix typo in new override flag 2019-09-20 19:36:09 +02:00
Simon Binder 161f7c0203
Optionally override hashCode and equals in result sets 2019-09-20 19:31:36 +02:00
Simon Binder 4e166f189c
Colorize errors in moor files again 2019-09-18 21:40:19 +02:00
Simon Binder 7121bac866
More work on the analyzer plugin
- finish migration to refactored generator
- document how to use the analysis plugin
- better error reporting without redundant messages
2019-09-18 20:48:44 +02:00
Simon Binder 00b2956b35
Allow data class names to be overridden in sql
Closes #147
2019-09-17 15:23:24 +02:00
Simon Binder 746b8401ec
Scan comments in sql 2019-09-16 22:33:36 +02:00
Simon Binder 2bf42a6157
Resolve table references declared by foreign key clause 2019-09-16 19:36:56 +02:00
Simon Binder 25ceda3505
Report lints about invalid Dart Templates in SQL 2019-09-15 11:59:47 +02:00
Simon Binder 5b6bd1db37
Fix some queries with Dart templates not compiling 2019-09-15 10:51:35 +02:00
Simon Binder c95a3badb2
Infer types for dart placeholder expressions
Also, infer where clauses to have a bool type
2019-09-14 22:44:20 +02:00
Simon Binder e89f9227ab
Don't write ResultSet classes for single-column queries
Fixes #148
2019-09-14 19:03:52 +02:00
Simon Binder 54c3dbc4b8
Write variables created in a dart template 2019-09-14 17:48:17 +02:00
Simon Binder 349b245089
Write implementation for Dart placeholders 2019-09-14 16:42:24 +02:00
Simon Binder bf7c9feddf
Write parameter declarations for Dart placeholders 2019-09-14 12:26:58 +02:00
Simon Binder 7a8191fe7e
Fix moor queries not expanding array vars properly 2019-09-14 09:27:36 +02:00
Simon Binder e9225cf759
Always generate private watch methods 2019-09-13 21:11:17 +02:00
Simon Binder c8ae99b52e
Breaking changes for the upcoming version
1. Removes transaction parameter in callbacks, custom queries
2. Removes MigrationStrategy.onFinished
2019-09-13 21:04:15 +02:00
Simon Binder 3097bb0591
Don't write get/watch methods for queries declared in moor 2019-09-13 20:23:48 +02:00
Simon Binder e50e7b3f21
Write integration test for tables feature 2019-09-13 20:01:09 +02:00
Simon Binder 156ef1ceb5
Support queries declared in .moor files 2019-09-12 21:08:30 +02:00
Simon Binder 6a0716daaf
Handle import statements and declared queries in .moor 2019-09-12 19:51:15 +02:00
Simon Binder f3db52717f
Extract steps into multiple files 2019-09-12 19:09:56 +02:00
Simon Binder b8cca3dcc2
Migrate AS plugin and build backend to new task api 2019-09-12 16:01:28 +02:00
Simon Binder e394292978
Refactor the backend (again)
We now have a two-pass parsing and analyzing model that
supports (zyklic) imports between Dart and moor files.
2019-09-11 23:00:46 +02:00
Simon Binder 28f13abfc3
Fix type converters loosing generic information
Fixes #144
2019-09-11 21:30:42 +02:00
Simon Binder a5cecd3ba6
Support moor file AST in the plugin 2019-09-09 20:34:14 +02:00
Simon Binder 1b7721a98f
Plugin: Import assists for column nullability 2019-09-08 21:36:26 +02:00
Simon Binder d79b04193c
Report syntax errors in moor files from the plugin 2019-09-08 11:22:36 +02:00
Simon Binder e807822f3f
Make plugin operate on the new MoorFile AST node 2019-09-08 10:29:59 +02:00
Simon Binder 7354b56712
Merge branch 'develop' into analyzer-plugin
# Conflicts:
#	moor_generator/lib/src/analyzer/moor/parser.dart
#	sqlparser/lib/src/engine/sql_engine.dart
2019-09-07 23:05:36 +02:00
Simon Binder 35e5bdb317
Introduce new top-level ast node for moor files 2019-09-07 21:33:56 +02:00
Simon Binder 8268867369
Fix analyzer errors, re-run build_runner 2019-09-07 20:01:33 +02:00
Simon Binder 1fcc6facee
Implement basic functionality of the analyzer plugin 2019-09-07 18:49:11 +02:00
Simon Binder 10dca6a8a9
Migrate analysis plugin to refactored generator 2019-09-07 15:19:40 +02:00
Simon Binder b550afd68f
Merge branch 'develop' into analyzer-plugin
# Conflicts:
#	moor_generator/lib/src/parser/moor/moor_analyzer.dart
2019-09-07 11:31:34 +02:00
Simon Binder 71d1bfdc9c
Scaffold api to support type converters in moor files
I still don't know how to parse expressions though :(
2019-09-06 22:23:44 +02:00
Simon Binder ba772ef07f
Better error handling when parsing multiple sql statements 2019-09-03 21:24:59 +02:00
Simon Binder 867f953107
Merge branch 'develop' into refactor-generator
# Conflicts:
#	moor_generator/lib/src/analyzer/sql_queries/lints/linter.dart
2019-09-03 19:35:23 +02:00
Simon Binder 35fcdb2c0f
Implement error handling in the refactored builder 2019-09-03 19:30:05 +02:00
Simon Binder 74dc2e5404
Finish refactoring of moor_generator 2019-09-02 20:28:57 +02:00
Simon Binder ad8bdba4b8
Start migration of writer code 2019-09-02 17:26:30 +02:00
Simon Binder 6e89a319ad
Refactored parser can now parse Dart tables 2019-08-31 12:22:25 +02:00
Simon Binder 23fca61961
Start with some refactoring in the generator
The idea is that we have a setup that let's us use multiple backends (build, analyzer plugin, standalone) with maximum code sharing.
2019-08-30 23:09:22 +02:00
Simon Binder 876db0671e
Provide lints on insert statements that will fail 2019-08-29 21:09:20 +02:00
Simon Binder 3cb00a4b31
Remove unnecessary "this." in insert companion constructor 2019-08-29 16:33:15 +02:00
Simon Binder 241baed0c3
Generate query implementations for insert statements 2019-08-29 16:27:55 +02:00
Simon Binder 4e83c0275b
Generate constructor for companions with @required fields 2019-08-29 13:54:08 +02:00
Simon Binder 0860b6645a
Generate selectable for custom queries
This makes is easier to use getSingle() and watchSingle()
on them.
Fixes #120
2019-08-27 18:44:34 +02:00
Simon Binder a3f6f1e326
Merge branch 'develop' into analyzer-plugin
# Conflicts:
#	moor_generator/pubspec.yaml
2019-08-26 15:32:28 +02:00
Simon Binder 397d3f2383
Support absent values on INTEGER PRIMARY KEY 2019-08-23 22:50:15 +02:00
Simon Binder a2c7b14862
Introduce flag to generate private watch methods 2019-08-19 19:04:15 +02:00
Simon Binder 3dcf59af63
Fix some bugs in the sql parser, another integration test 2019-08-17 22:21:34 +02:00
Simon Binder 4ce9e12c0e
Write copyWith methods in companion classes
Fixes #102
2019-08-16 15:01:03 +02:00
Simon Binder c7a0397fb6
Verify that generated queries don't skip indexes 2019-08-16 14:44:40 +02:00
Simon Binder 7d89f12aa7
Use explicit indices for array parameters 2019-08-15 21:26:27 +02:00
Simon Binder aa6fea6caa
Fix wrong double primary key on generated tables 2019-08-01 20:14:42 +02:00
Simon Binder f4bd6828a9
Some more fixes on the analyzer
Sadly, the analyzer doesn't support custom file types yet,
so that's it for the moor analyzer plugin for now.
2019-07-31 18:05:54 +02:00
Simon Binder 4210c0c836
Start some work on the analyzer plugin
Of course it's not working at all
2019-07-30 18:34:33 +02:00
Simon Binder 4e75cee785
Merge branch 'develop' into analyzer-plugin 2019-07-30 14:17:37 +02:00
Simon Binder b1820ef5aa
Generate code to match default values for CREATE TABLE 2019-07-30 10:30:06 +02:00
Simon Binder aa3706ae9d
Support table constraints in CREATE TABLE 2019-07-30 10:13:47 +02:00
Simon Binder 3819eae1e8
Merge branch 'develop' into analyzer-plugin 2019-07-29 18:08:21 +02:00
Simon Binder 634b1adb72
Support includes on the @UseDao annotation as well 2019-07-29 15:19:58 +02:00
Simon Binder e0a82b0e32
Finally generate table classes from sql 2019-07-29 14:22:39 +02:00
Simon Binder 4798d0a7e5
Parse specified tables from .moor files 2019-07-29 12:54:49 +02:00
Simon Binder 5ddcd17c21
Scaffold the package layout of a future analyzer plugin 2019-07-29 10:27:50 +02:00
Simon Binder b4cdcf0431
Support type converters in compiled custom statements 2019-07-28 00:02:17 +02:00
Simon Binder dbda5dccc1
Cache type converters in static fields 2019-07-27 22:44:44 +02:00
Simon Binder 37cba6971c
Attempt to fix coverage collection 2019-07-20 22:15:52 +02:00
Simon Binder 35e6ed67df
Use new GeneratorSession for the writer 2019-07-20 10:18:41 +02:00
Simon Binder e6cf035ad2
Put dao parser in own file 2019-07-18 20:27:07 +02:00
Simon Binder 001de4dc79
Extract logic out of moor generator in some smaller files 2019-07-18 18:17:58 +02:00
Simon Binder c5e9e8cfc8
Start generator refactoring
Remove global shared state in favor of sessions that are only valid for a single build step.
2019-07-18 18:01:27 +02:00
Simon Binder ff93af231c
Write correct mapping code for custom objects 2019-07-18 12:53:26 +02:00
Simon Binder bf4d16add6
Write verification and to-sql mapping for custom columns 2019-07-18 12:21:10 +02:00
Simon Binder c2bff3ae42
API and parser for custom types 2019-07-18 12:02:16 +02:00
Simon Binder 0e7ee6114b
Avoid writing duplicate mapping methods 2019-07-10 19:37:15 +02:00
Simon Binder 02a8dabd63
Fix crash when variables appear more than once 2019-07-10 18:25:18 +02:00
Simon Binder df05e643e0
Migrate example to 1.6, update readme 2019-07-10 17:55:57 +02:00
Simon Binder 809f239ca3
Generate code for array variables in compiled statements 2019-07-07 16:04:55 +02:00
Simon Binder 2a51a04cc8
Remove usage of ParsedLibraryResultImpl.tmp 2019-07-05 18:36:05 +02:00
Simon Binder 316f9e1052
Only resolve columns declared in scope of a statement
Fixes #52
2019-07-02 12:28:54 +02:00
Simon Binder 3dddc6993a
Remove outdated todo entries 2019-07-01 21:37:08 +02:00
Simon Binder 464754267e
Document new features for version 1.5 2019-06-30 22:16:58 +02:00
Simon Binder f5492b8bcb
Generate code for update and delete statements 2019-06-30 19:34:54 +02:00
Simon Binder f8834f0e15
More fluent api to define queries 2019-06-30 13:35:13 +02:00
Simon Binder b4de942915
Write query engine override param for generated queries
This allows them to be used in transactions and post-
migration callbacks.
2019-06-30 13:09:07 +02:00
Simon Binder 53ea5835a8
For custom queries, use a matching data class if possible 2019-06-30 12:01:46 +02:00
Simon Binder ff530dd4ea
Improve documentation of the sqlparser library 2019-06-29 22:29:16 +02:00
Simon Binder 22f78589db
Support custom queries in daos 2019-06-29 15:51:23 +02:00
Simon Binder 1ea1c12592
Make the dao generator use the same logic as the main one 2019-06-29 15:43:41 +02:00
Simon Binder 7becfdcb85
Don't use the MoorGenerator as a god class 2019-06-29 15:34:27 +02:00
Simon Binder 53d57d6a96
Refactor generator: Extract common operations 2019-06-29 15:23:14 +02:00
Simon Binder 33682a0ad1
Write readsFrom field for custom queries 2019-06-29 14:04:01 +02:00
Simon Binder d930664581
Escape strings before writing dart literals 2019-06-29 13:55:13 +02:00
Simon Binder 646987ad69
Correctly write variables in analyzed queries 2019-06-29 13:47:33 +02:00
Simon Binder 2a8edbde0d
Write implementation methods for queries 2019-06-29 11:23:06 +02:00
Simon Binder 40a4ebdadf
Started to integrate the sqlparser into moor generator 2019-06-28 23:41:27 +02:00
Simon Binder 1d36e3316d
Merge branch 'delightful-queries' into develop 2019-06-22 19:02:57 +02:00
Simon Binder 151c374bfe
Fix outdated use of Value.use() in generated code 2019-06-21 21:07:06 +02:00
Simon Binder 62c5106e7d
Migrate tests to companion 2019-06-21 20:29:42 +02:00
Simon Binder 0616fb7082
Migrate to update companions everywhere :) 2019-06-21 20:08:42 +02:00
Simon Binder 0abc3993f4
Fully migrate to new update companions 2019-06-21 19:48:18 +02:00
Simon Binder eee11d53d3
Start to migrate verification logic with update companions 2019-06-21 10:48:42 +02:00
Simon Binder ecf6740cb7
Constraints on type parameters for data classes 2019-06-21 10:27:14 +02:00
Simon Binder 6ac9109c0a
Fix dead code in generated update companions 2019-06-21 09:44:38 +02:00
Simon Binder b79611e6e0
Backwards compatibility: Use DataClasses as companion 2019-06-21 09:42:42 +02:00
Simon Binder ec2592203c
Generate update companions for data classes 2019-06-21 09:16:22 +02:00
Simon Binder 2a5ede1c04
Merge branch 'develop' into delightful-queries 2019-06-16 14:52:49 +02:00
Simon Binder 5fc921aefc
Provide detailed error messages for inconsistent data 2019-06-16 14:44:43 +02:00
Simon Binder 52f3ee045f
Extract sql parser to yet another subpackage 2019-06-15 23:01:10 +02:00
Simon Binder c297b27f60
Scan identifiers 2019-06-15 15:16:58 +02:00
Simon Binder cafaafe2eb
Start with new custom scanner 2019-06-15 15:16:57 +02:00
Simon Binder 69f0b9b393
Begin with simple ast and parser 2019-06-15 15:16:48 +02:00
Simon Binder 87e39c7ad4
Add an option to generate fromJsonString factories 2019-06-09 22:58:06 +02:00
Simon Binder f87472e980
Enable and enforce curly brace for control flow lint 2019-06-09 12:30:12 +02:00
Simon Binder 9241bbccc1
Better integration of floating-point values 2019-06-08 15:04:49 +02:00
Simon Binder 8cc2c21c9a
Annotation to change the generated json key 2019-06-04 22:04:21 +02:00
Simon Binder 023c055e44
Implement new serialization api in generated classes 2019-05-23 19:17:47 +02:00
Simon Binder 5db9a5f87d
Actually use the real type, add parent for data classes 2019-05-17 21:25:02 +02:00
Simon Binder b2345a9f28
Add real datatype for numeric values 2019-05-12 10:53:00 +02:00
Simon Binder 12d510e78f
Explain deprecated member use of "elements2" 2019-05-06 20:42:18 +02:00
Simon Binder cd520e5d1e
Fix syntax error in generated code with empty primary key 2019-04-29 18:25:03 +02:00
Simon Binder 091eff1c4e
Merge branch 'master' into develop
# Conflicts:
#	moor_generator/pubspec.yaml
2019-04-14 16:51:37 +02:00
Simon Binder f28eb13b4c
Fix hashcodes, document joins 2019-04-06 13:11:49 +02:00
Simon Binder ab5ac57778
Use jenkins hash 2019-04-05 17:47:51 +02:00
Simon Binder 040f54d004
Write default expressions in column creations 2019-04-01 15:20:01 +02:00
Simon Binder c3f6042c8f
Parse default expressions 2019-04-01 14:44:44 +02:00
Simon Binder d284aca4f6
Improve examples app, fix many issues with joins 2019-04-01 12:27:13 +02:00
Simon Binder e36470211c
Implement transactions 2019-03-31 17:06:22 +02:00
Simon Binder 9ca52d7f87
Use aliases in the operations 2019-03-30 19:21:44 +01:00
Simon Binder df2a681410
Preparation for aliased tables 2019-03-30 18:48:09 +01:00
Simon Binder e05303568f
Upgrade analyzer version 2019-03-27 20:21:57 +01:00
Simon Binder 9490cd22fe
Finish custom constraints implementation 2019-03-27 18:37:29 +01:00
Simon Binder 99d245d0ac
Expand docs on how write database / dao classes 2019-03-27 18:08:41 +01:00
Simon Binder aa6582ae79
Always return the same stream for equal queries 2019-03-20 12:28:18 +01:00
Simon Binder 0cfebf59dc
Support SetOrMapLiteral directly 2019-03-19 13:07:15 +01:00
Simon Binder 3e1cbee3c6
Implement fromJson factory in data classes. 2019-03-15 17:56:39 +01:00
Simon Binder e7cb0cb2e5
Merge pull request #3 from yohom/master
Add a `toJson` method for serialization.
2019-03-15 07:23:03 +01:00
yohom c24f3caff2 `Map<String, Object>` -> `Map<String, dynamic>` 2019-03-15 08:52:54 +08:00
Simon Binder 81fe2e7feb
Implement custom column constraints 2019-03-14 19:11:26 +01:00
yohom c13b0ff17f Add a `toJson` method for serialization. 2019-03-14 17:42:58 +08:00
Simon Binder 5de1656e07
Memoized getters for generated classes 2019-03-10 20:04:32 +01:00
Simon Binder e3fbbb8c13
Implement a BlobColumn to hold arbitrary data 2019-03-10 19:45:32 +01:00
Simon Binder cbd217317a
Let data classes override toString() 2019-03-10 12:54:50 +01:00
Simon Binder bfe1cb8017
Published version 1.0.0 on pub! 2019-03-09 21:00:19 +01:00
Simon Binder d70b447c65
Fix some typos 2019-03-09 20:35:29 +01:00
Simon Binder 4d80ff77c9
Finalize renaming 2019-03-09 17:02:56 +01:00