Skip to content

Commit e8c6c27

Browse files
committed
fix: mode
1 parent 7480555 commit e8c6c27

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ $loader = Yajra\SQLLoader\SQLLoader::make();
2626
$loader->inFile(database_path('files/employees.csv'))
2727
->as('employees.ctl')
2828
->options(['skip=1'])
29-
->method(Yajra\SQLLoader\Method::TRUNCATE)
29+
->mode(Yajra\SQLLoader\Mode::TRUNCATE)
3030
->into(
3131
table: 'employees',
3232
columns: [
@@ -69,7 +69,7 @@ Route::get('sql-loader', function () {
6969
$loader = Yajra\SQLLoader\SQLLoader::make();
7070
$loader->inFile(database_path('files/employees.csv'))
7171
->options(['skip=1'])
72-
->method(Yajra\SQLLoader\Method::TRUNCATE)
72+
->mode(Yajra\SQLLoader\Mode::TRUNCATE)
7373
->into('employees', [
7474
'name',
7575
'dept_id',

src/ControlFileBuilder.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ protected function inputFiles(): string
4242

4343
protected function method(): string
4444
{
45-
return in_array($this->loader->method, [
46-
Method::INSERT,
47-
Method::TRUNCATE,
48-
]) ? Method::TRUNCATE->value : $this->loader->method->value;
45+
return in_array($this->loader->mode, [
46+
Mode::INSERT,
47+
Mode::TRUNCATE,
48+
]) ? Mode::TRUNCATE->value : $this->loader->mode->value;
4949
}
5050

5151
protected function inserts(): string

src/Method.php renamed to src/Mode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Yajra\SQLLoader;
66

7-
enum Method: string
7+
enum Mode: string
88
{
99
case INSERT = 'INSERT';
1010
case APPEND = 'APPEND';

src/SQLLoader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class SQLLoader
2121
/** @var TableDefinition[] */
2222
public array $tables = [];
2323

24-
public Method $method = Method::APPEND;
24+
public Mode $mode = Mode::APPEND;
2525

2626
public ?string $controlFile = null;
2727

@@ -61,9 +61,9 @@ public function inFile(
6161
return $this;
6262
}
6363

64-
public function method(Method $method): static
64+
public function mode(Mode $mode): static
6565
{
66-
$this->method = $method;
66+
$this->mode = $mode;
6767

6868
return $this;
6969
}

0 commit comments

Comments
 (0)