-
Notifications
You must be signed in to change notification settings - Fork 26
Refract/cleanup - Added Test suite / formating etc. #32
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
Conversation
…and git-cliff usage
…es for User, UserProfile, Client, ClientLog, ClientProfile, BlogPost, Company, and CompanyLog
… corresponding factory
- Enabled PHPStan for code linting to enhance code quality checks. - Updated `flake.nix` to include PHPStan in the CI pipeline.
|
Pint, did add it to composer dev. Tho I saw some weird formatting, but I think that was when I was switching branches and an outdated gitignore caused chaos. Anyway. Pint good sir |
Got it. I'm using PHP CS Fixer. I will switch that off and add Pint. This is all looking really good I think. I get how the package works now So its getting easier to add features. I am also using tests from the MongoDB package and converting them to work with laravel-elasticsearch. |
|
Super. Let's park any new features for now. I really want to ship this and use it as the base going forward. Great work |
Agreed! I will make a new branch on my repo for anything else I am doing and merge in as separate PR after this goes in. |
|
Update: I have made a few changes to the bulk method:
{
"success": true,
"timed_out": false,
"took": 5082,
"total": 100000,
"created": 100000,
"modified": 0,
"failed": 0
}(That's a real result by the way, amazing that it can create 100k records in 5sec) If there are any errors, it will return the details in an error field: {
"success": false,
"timed_out": false,
"took": 5055,
"total": 100000,
"created": 99619,
"modified": 0,
"failed": 381,
"error": [....], //<-errors in here
"errorMessage": "Bulk insert failed for some values"
}It also differentiates between created/modified, ex: $prods = Product::limit(100)->get();
return Product::insert($prods->toArray());{
"success": true,
"timed_out": false,
"took": 7,
"total": 100,
"created": 0,
"modified": 100,
"failed": 0
}insert has a second parameter if you want the [successful] data returned $prods = Product::limit(100)->get();
$updatedProds = Product::insert($prods->toArray(),true);
return $updatedProds; //shows the data, not the summaryThe reason that this is not the default is that at mass this will exhaust most memory settings Another major upgrade is that $prods = Product::limit(100)->get();
$updatedProds = Product::insert($prods->toArray(),true);
return $updatedProds->getQueryMetaAsArray();$prods = Product::where('orders','>=',100)->get();
$prods->getDsl();
$prods->getQueryMetaAsArray();Let's peg it here now, then finish up the last of the tests and get this shipped |
|
@pdphilip Yea, this all makes sense to me, and I thought about doing something similar. I think your approach works well. What other tests do we need before this can get merged in? |
|
I guess just the Then we go. |
|
@pdphilip Is there a reason you removed: With out it it never waits for a refresh so it ends up failing tests since it's still building the records. I am going to add it back in since that way we can add insertWithOutRefresh in the future. |
|
Go for it |
with that back in it's working perfect! I am going to add a test to make sure it's returning a ElasticCollection and after that I think you can ship. |
- Added optional `refresh` parameter to `insertBulk` method in `Connection.php`. - Updated `processInsertBulk` method in `DSL/Bridge.php` to handle the new parameter. - Modified `insertBulk` call in `Query/Builder.php` to include `refresh` parameter. - Implemented a new test in `Eloquent/InsertTest.php` to verify the functionality.
|
@pdphilip This is ready for you! |
- Introduced rootDir variable for consistency. - Added Laravel Pint formatter configuration to treefmt. - Removed redundant php-cs-fixer setup. - Disabled phpstan linting.
|
@use-the-fork your CI is excellent, tested it and works great. Well done. I'm going to leave the This is an amazing contribution, thanks a bunch. And I hope you'll stick around for more. |
|
Also, if you'd like to be in touch, shoot me an email (in composer) |
Yeah, some of the TODO tests require code additions that will make this PR to be even larger. I was just leaving them as placeholders until this gets merged in, and I can create smaller, easier-to-review PRs. The CI is also not done I needed it merged into the main so I can modify it and test it in my branch. Github is weird and if its not in the main branch I can't test any changes :( I'm not going anywhere I use this package all the time easily one of the most useful packages I have ever found so I'm excited to contribute! |
This commit introduces several new features and improvements to the package:
There is definitely work to be done with coverage but in general this is a solid foundation:
