Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tables
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
grifart libs
tables
Commits
cf1bb54a
Verified
Commit
cf1bb54a
authored
2 years ago
by
Jan Kuchař
Browse files
Options
Downloads
Patches
Plain Diff
README.md: fixed database Type declarations (as there were changes in constructors)
parent
fa659c29
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!40
CompositeType: add explicit type cast to support composite values in WHERE clause
Pipeline
#43003
passed
2 years ago
Stage: install
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+5
-5
5 additions, 5 deletions
README.md
with
5 additions
and
5 deletions
README.md
+
5
−
5
View file @
cf1bb54a
...
...
@@ -158,7 +158,7 @@ final class IsLike implements Condition
return
new
\Dibi\Expression
(
'? LIKE ?'
,
$this
->
expression
->
toSql
(),
mapToDatabase
(
$this
->
pattern
,
new
TextType
()),
mapToDatabase
(
$this
->
pattern
,
TextType
::
varchar
()),
);
}
}
...
...
@@ -221,7 +221,7 @@ final class Year implements Expression
public
function
getType
():
Type
{
return
new
IntType
();
return
IntType
::
integer
();
}
}
```
...
...
@@ -249,7 +249,7 @@ $rows = $table->findBy(
You can also use the
`expr()`
function to create such expression:
```
php
$year
=
fn
(
Expression
$expr
)
=>
expr
(
new
IntType
(),
"EXTRACT ('year' FROM ?)"
,
$expr
->
toSql
());
$year
=
fn
(
Expression
$expr
)
=>
expr
(
IntType
::
integer
(),
"EXTRACT ('year' FROM ?)"
,
$expr
->
toSql
());
$rows
=
$table
->
findBy
(
$year
(
$table
->
createdAt
())
->
is
(
equalTo
(
2021
)),
);
...
...
@@ -409,8 +409,8 @@ $moneyType = new class extends CompositeType {
{
parent
::
__construct
(
new
Database\NamedType
(
new
Database\Identifier
(
'public'
,
'money'
)),
new
DecimalType
(),
new
CurrencyType
(),
DecimalType
::
decimal
(),
new
CurrencyType
(),
// custom type
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment