Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
8f511237
Commit
8f511237
authored
7 years ago
by
Simon Belak
Browse files
Options
Downloads
Patches
Plain Diff
Don't contort the type system for IDs, but just check during binding
parent
ee4abd16
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/metabase/automagic_dashboards/core.clj
+6
-4
6 additions, 4 deletions
src/metabase/automagic_dashboards/core.clj
with
6 additions
and
4 deletions
src/metabase/automagic_dashboards/core.clj
+
6
−
4
View file @
8f511237
...
...
@@ -156,12 +156,15 @@
(
or
(
isa?
special_type
t
)
(
isa?
base_type
t
)))
(
defn-
numeric-key
?
(
defn-
key-col
?
"Workaround for our leaky type system which conflates types with properties."
[{
:keys
[
base_type
special_type
name
]}]
(
and
(
isa?
base_type
:type/Number
)
(
or
(
#
{
:type/PK
:type/FK
}
special_type
)
(
->
name
str/lower-case
(
=
"id"
)))))
(
let
[
name
(
str/lower-case
name
)]
(
or
(
=
name
"id"
)
(
str/starts-with?
name
"id_"
)
(
str/ends-with?
name
"_id"
))))))
(
def
^
:private
field-filters
{
:fieldspec
(
fn
[
fieldspec
]
...
...
@@ -177,9 +180,8 @@
target
(
recur
target
)
:else
(
and
(
not
(
numeric-key
?
field
))
(
and
(
not
(
key-col
?
field
))
(
field-isa?
field
fieldspec
))))))
:named
(
fn
[
name-pattern
]
(
comp
(
->>
name-pattern
...
...
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