MCPcopy Index your code
hub / github.com/WebDevSimplified/feature-flags-sample-code / getProducts

Function getProducts

src/db/products.ts:5–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import { sql } from "@/lib/sql"
4
5export function getProducts() {
6 const products = sql().select("*").from("products")
7
8 if (canViewFeature("TEST_NEW_PRODUCTS_QUERY", getUser())) {
9 const altProducts = sql().query.products.findMany()
10
11 console.assert(
12 products.length === altProducts.length &&
13 products.every(product => {
14 return altProducts.find(alt => alt.id === product.id)
15 })
16 )
17 }
18
19 return products
20}

Callers

nothing calls this directly

Calls 3

sqlFunction · 0.90
canViewFeatureFunction · 0.90
getUserFunction · 0.90

Tested by

no test coverage detected