This commit is contained in:
2021-03-26 14:53:47 +08:00
parent a67200e4fb
commit 745322cc3e
2 changed files with 105 additions and 0 deletions
+26
View File
@@ -15,6 +15,10 @@ use Database\ActiveRecord;
use Database\Condition\MathematicsCondition;
use Database\Sql;
use Exception;
use JetBrains\PhpStorm\Pure;
use ReflectionException;
use Snowflake\Exception\NotFindClassException;
use Snowflake\Snowflake;
/**
* Trait QueryTrait
@@ -58,6 +62,17 @@ trait QueryTrait
}
/**
* @param string $column
* @param callable $callable
* @return CaseWhen
*/
public function case(string $column, callable $callable): CaseWhen
{
return call_user_func($callable, new CaseWhen($column, $this));
}
/**
* @param $condition
* @param $condition1
@@ -678,6 +693,17 @@ trait QueryTrait
}
/**
* @return Sql
* @throws ReflectionException
* @throws NotFindClassException
*/
public function makeNewSqlGenerate(): Sql
{
return Snowflake::createObject(Sql::class);
}
/**
* @param $columns
* @param $value