Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Update backend docs on Mon Jan 8 17:24:17 UTC 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Jan 8, 2024
1 parent 985a247 commit 19ffedd
Showing 1 changed file with 15 additions and 50 deletions.
65 changes: 15 additions & 50 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9230,13 +9230,15 @@ <h2>Important Libraries</h2>
[:not [:like :location &quot;/%/%/&quot;]]))</pre></td></tr><tr><td class="docs">
</td><td class="codes"><pre class="brush: clojure">(defn- remove-other-users-personal-subcollections
[user-id collections]
(let [personal-ids (t2/select-fn-set :id :model/Collection
{:where
[:and [:!= :personal_owner_id nil] [:!= :personal_owner_id user-id]]})
personal-descendant? (comp personal-ids
first
collection/location-path-&gt;ids
:location)]
(let [personal-ids (set (t2/select-fn-set :id :model/Collection
{:where
[:and [:!= :personal_owner_id nil] [:!= :personal_owner_id user-id]]}))
personal-descendant? (fn [collection]
(let [first-parent-collection-id (-&gt; collection
:location
collection/location-path-&gt;ids
first)]
(personal-ids first-parent-collection-id)))]
(remove personal-descendant? collections)))</pre></td></tr><tr><td class="docs"><p>Select collections based off certain parameters. If <code>shallow</code> is true, we select only the requested collection (or
the root, if <code>collection-id</code> is <code>nil</code>) and its immediate children, to avoid reading the entire collection tree when it
is not necessary.</p>
Expand Down Expand Up @@ -42195,11 +42197,8 @@ <h6>`:abstract?` (default = false)</h6>
filter-args-display-name]
[lib.field
add-field
field-id
legacy-card-or-table-id
fieldable-columns
fields
find-visible-column-for-legacy-ref
find-visible-column-for-ref
remove-field
with-fields]
Expand Down Expand Up @@ -44687,7 +44686,6 @@ <h6>`:abstract?` (default = false)</h6>
[metabase.lib.aggregation :as lib.aggregation]
[metabase.lib.binning :as lib.binning]
[metabase.lib.card :as lib.card]
[metabase.lib.convert :as lib.convert]
[metabase.lib.dispatch :as lib.dispatch]
[metabase.lib.equality :as lib.equality]
[metabase.lib.expression :as lib.expression]
Expand Down Expand Up @@ -45150,18 +45148,7 @@ <h6>`:abstract?` (default = false)</h6>
(mapv (fn [col]
(assoc col :selected? true))
visible-columns)
(lib.equality/mark-selected-columns query stage-number visible-columns selected-fields)))))</pre></td></tr><tr><td class="docs">
</td><td class="codes"><pre class="brush: clojure">(mu/defn field-id :- [:maybe ::lib.schema.common/int-greater-than-or-equal-to-zero]
&quot;Find the field id for something or nil.&quot;
[field-metadata :- ::lib.schema.metadata/column]
(:id field-metadata))</pre></td></tr><tr><td class="docs">
</td><td class="codes"><pre class="brush: clojure">(mu/defn legacy-card-or-table-id :- [:maybe [:or :string ::lib.schema.common/int-greater-than-or-equal-to-zero]]
&quot;Find the legacy card id or table id for a given ColumnMetadata or nil.
Returns a either `\&quot;card__&lt;id&gt;\&quot;` or integer table id.&quot;
[{card-id :lib/card-id table-id :table-id} :- ::lib.schema.metadata/column]
(cond
card-id (str &quot;card__&quot; card-id)
table-id table-id))</pre></td></tr><tr><td class="docs"><p>Given a query and stage, sets the <code>:fields</code> list to be the fields which would be selected by default.
(lib.equality/mark-selected-columns query stage-number visible-columns selected-fields)))))</pre></td></tr><tr><td class="docs"><p>Given a query and stage, sets the <code>:fields</code> list to be the fields which would be selected by default.
This is exactly [[lib.metadata.calculation/returned-columns]] filtered by the <code>:lib/source</code>.
Fields from explicit joins are listed on the join itself and should not be listed in <code>:fields</code>.</p>
</td><td class="codes"><pre class="brush: clojure">(defn- populate-fields-for-stage
Expand Down Expand Up @@ -45315,17 +45302,7 @@ <h6>`:abstract?` (default = false)</h6>
lib.metadata.calculation/returned-columns
lib.metadata.calculation/visible-columns)
query stage-number stage)]
(lib.equality/find-matching-column query stage-number field-ref columns))))</pre></td></tr><tr><td class="docs"><p>TODO: Refactor this away - handle legacy refs in lib.js and using <code>lib.equality</code> directly from there.</p>
</td><td class="codes"><pre class="brush: clojure">(mu/defn find-visible-column-for-legacy-ref :- [:maybe ::lib.schema.metadata/column]
&quot;Like [[find-visible-column-for-ref]], but takes a legacy MBQL reference instead of a pMBQL one. This is currently
only meant for use with `:field` clauses.&quot;
([query legacy-ref]
(find-visible-column-for-legacy-ref query -1 legacy-ref))
([query :- ::lib.schema/query
stage-index :- :int
legacy-ref :- some?]
(let [a-ref (lib.convert/legacy-ref-&gt;pMBQL query stage-index legacy-ref)]
(find-visible-column-for-ref query stage-index a-ref))))</pre></td></tr><tr><td class="docs"><p>Return true if field is a JSON field, false if not.</p>
(lib.equality/find-matching-column query stage-number field-ref columns))))</pre></td></tr><tr><td class="docs"><p>Return true if field is a JSON field, false if not.</p>
</td><td class="codes"><pre class="brush: clojure">(defn json-field?
[field]
(some? (:nfc-path field)))</pre></td></tr><tr><td class="docs"><p>yes, this is intentionally different from the version in <code>:metabase.lib.schema.metadata/column.has-field-values</code>.
Expand Down Expand Up @@ -47310,14 +47287,7 @@ <h6>`:abstract?` (default = false)</h6>
;; different object. Test that idea and remove the stage from the cache key.
(lib.cache/side-channel-cache
(keyword &quot;display-info-outer&quot; (str &quot;stage-&quot; stage-number)) x
#(display-info* a-query stage-number %)))</pre></td></tr><tr><td class="docs"><p>Find the field id for something or nil.</p>
</td><td class="codes"><pre class="brush: clojure">(defn ^:export field-id
[field-metadata]
(lib.core/field-id field-metadata))</pre></td></tr><tr><td class="docs"><p>Find the legacy card id or table id for a given ColumnMetadata or nil.
Returns a either <code>"card__&lt;id&gt;"</code> or integer table id.</p>
</td><td class="codes"><pre class="brush: clojure">(defn ^:export legacy-card-or-table-id
[field-metadata]
(lib.core/legacy-card-or-table-id field-metadata))</pre></td></tr><tr><td class="docs"><p>Create an order-by clause independently of a query, e.g. for <code>replace</code> or whatever.</p>
#(display-info* a-query stage-number %)))</pre></td></tr><tr><td class="docs"><p>Create an order-by clause independently of a query, e.g. for <code>replace</code> or whatever.</p>
</td><td class="codes"><pre class="brush: clojure">(defn ^:export order-by-clause
([orderable]
(order-by-clause orderable :asc))
Expand Down Expand Up @@ -47568,12 +47538,7 @@ <h6>`:abstract?` (default = false)</h6>
itself should be removed from the query.</p>
</td><td class="codes"><pre class="brush: clojure">(defn ^:export remove-field
[a-query stage-number column]
(lib.core/remove-field a-query stage-number column))</pre></td></tr><tr><td class="docs"><p>Like [[find-visible-column-for-ref]], but takes a legacy MBQL reference instead of a pMBQL one. This is currently
only meant for use with <code>:field</code> clauses.</p>
</td><td class="codes"><pre class="brush: clojure">(defn ^:export find-visible-column-for-legacy-ref
[a-query stage-number a-legacy-ref]
;; [[lib.convert/legacy-ref-&gt;pMBQL]] will handle JS -&gt; Clj conversion as needed
(lib.core/find-visible-column-for-legacy-ref a-query stage-number a-legacy-ref))</pre></td></tr><tr><td class="docs"><p>Given a sequence of <code>columns</code> (column metadatas), return the one that is the best fit for <code>legacy-ref</code>.</p>
(lib.core/remove-field a-query stage-number column))</pre></td></tr><tr><td class="docs"><p>Given a sequence of <code>columns</code> (column metadatas), return the one that is the best fit for <code>legacy-ref</code>.</p>
</td><td class="codes"><pre class="brush: clojure">(defn ^:export find-column-for-legacy-ref
[a-query stage-number a-legacy-ref columns]
;; [[lib.convert/legacy-ref-&gt;pMBQL]] will handle JS -&gt; Clj conversion as needed
Expand Down Expand Up @@ -94593,8 +94558,8 @@ <h3>`::position`</h3>
(sync-util/create-sync-step &quot;sync-table-privileges&quot; sync-table-privileges/sync-table-privileges!)])</pre></td></tr><tr><td class="docs"><p>Sync the metadata for a Metabase <code>database</code>. This makes sure child Table &amp; Field objects are synchronized.</p>
</td><td class="codes"><pre class="brush: clojure">(mu/defn sync-db-metadata!
[database :- i/DatabaseInstance]
(let [db-metadata (fetch-metadata/db-metadata database)]
(sync-util/sync-operation :sync-metadata database (format &quot;Sync metadata for %s&quot; (sync-util/name-for-logging database))
(sync-util/sync-operation :sync-metadata database (format &quot;Sync metadata for %s&quot; (sync-util/name-for-logging database))
(let [db-metadata (fetch-metadata/db-metadata database)]
(u/prog1 (sync-util/run-sync-operation &quot;sync&quot; database (make-sync-steps db-metadata))
(if (some sync-util/abandon-sync? (map second (:steps &lt;&gt;)))
(sync-util/set-initial-database-sync-aborted! database)
Expand Down

0 comments on commit 19ffedd

Please sign in to comment.