Edits history of script submission #282 for ' Fetch data (supabase)'

  • deno
    import { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
    
    /**
     * @param access_token It is only needed if you have an affecting RLS policy enabled
     * on the table that you want to access.
     * Learn more about RLS here: https://supabase.com/docs/guides/auth/row-level-security
     * 
     * @param count Count algorithm to use to count rows in the table or view.
     * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the hood.
     * `"planned"`: Approximated but fast count algorithm. Uses the Postgres statistics under the hood.
     * `"estimated"`: Uses exact count for low numbers and planned count for high numbers.
     *
     * @param head When set to `true`, `data` will not be returned.
     * Useful if you only need the count.
     * 
     * @param filter Learn more at https://supabase.com/docs/reference/javascript/filter
     * 
     * @param order Learn more at https://supabase.com/docs/reference/javascript/order
     * 
     * @param limit Learn more at https://supabase.com/docs/reference/javascript/limit
     */
    export async function main(
      auth: Resource<"supabase">,
      table: string,
      columns?: string,
      access_token?: string,
      count?: "exact" | "planned" | "estimated",
      head?: boolean,
      filter?: {
        column: string;
        operator: string;
        value: any;
      },
      order?: {
        column: string;
        foreignTable: string;
        ascending?: boolean;
        nullsFirst?: boolean;
      },
      limit?: {
        count: number;
        foreignTable?: string;
      },
    ) {
      const headers = access_token ? {
        global: { headers: { Authorization: `bearer ${access_token}` } },
      } : undefined
      const client = createClient(auth.url, auth.key, headers);
      const options = (head || count) ? { head, count } : undefined;
      let query = client.from(table).select(columns || undefined, options);
      if (filter?.column) {
        query = query.filter(filter.column, filter.operator, filter.value);
      }
      if (order?.column) {
        const { column, ...options } = order;
        query = query.order(column, options);
      }
      if (limit?.count) {
        const { count, foreignTable } = limit;
        query = query.limit(count, foreignTable ? { foreignTable } : undefined);
      }
    
      return await query;
    }
    

    Submitted by adam186 1155 days ago

  • deno
    import { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
    
    /**
     * @param access_token It is only needed if you have an affecting RLS policy enabled
     * on the table that you want to access.
     * Learn more about RLS here: https://supabase.com/docs/guides/auth/row-level-security
     * 
     * @param count Count algorithm to use to count rows in the table or view.
     * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the hood.
     * `"planned"`: Approximated but fast count algorithm. Uses the Postgres statistics under the hood.
     * `"estimated"`: Uses exact count for low numbers and planned count for high numbers.
     *
     * @param head When set to `true`, `data` will not be returned.
     * Useful if you only need the count.
     * 
     * @param filter Learn more at https://supabase.com/docs/reference/javascript/filter
     * 
     * @param order Learn more at https://supabase.com/docs/reference/javascript/order
     * 
     * @param limit Learn more at https://supabase.com/docs/reference/javascript/limit
     */
    export async function main(
      auth: Resource<"supabase">,
      table: string,
      columns?: string,
      access_token?: string,
      count?: "exact" | "planned" | "estimated",
      head?: boolean,
      filter?: {
        column: string;
        operator: string;
        value: any;
      },
      order?: {
        column: string;
        foreignTable: string;
        ascending?: boolean;
        nullsFirst?: boolean;
      },
      limit?: {
        count: number;
        foreignTable?: string;
      },
    ) {
      const headers = access_token ? {
        global: { headers: { Authorization: `bearer ${access_token}` } },
      } : undefined
      const client = createClient(auth.url, auth.key, headers);
      const options = (head || count) ? { head, count } : undefined;
      let query = client.from(table).select(columns || undefined, options);
      if (filter?.column) {
        query = query.filter(filter.column, filter.operator, filter.value);
      }
      if (order?.column) {
        const { column, ...options } = order;
        query = query.order(column, options);
      }
      if (limit?.count) {
        const { count, foreignTable } = limit;
        query = query.limit(count, foreignTable ? { foreignTable } : undefined);
      }
    
      return await query;
    }
    

    Submitted by adam186 1163 days ago

  • deno
    import { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
    
    /**
     * @param count Count algorithm to use to count rows in the table or view.
     * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the hood.
     * `"planned"`: Approximated but fast count algorithm. Uses the Postgres statistics under the hood.
     * `"estimated"`: Uses exact count for low numbers and planned count for high numbers.
     *
     * @param head When set to `true`, `data` will not be returned.
     * Useful if you only need the count.
     * 
     * @param filter Learn more at https://supabase.com/docs/reference/javascript/filter
     * 
     * @param order Learn more at https://supabase.com/docs/reference/javascript/order
     * 
     * @param limit Learn more at https://supabase.com/docs/reference/javascript/limit
     */
    export async function main(
      auth: Resource<"supabase">,
      table: string,
      columns?: string,
      access_token?: string,
      count?: "exact" | "planned" | "estimated",
      head?: boolean,
      filter?: {
        column: string;
        operator: string;
        value: any;
      },
      order?: {
        column: string;
        foreignTable: string;
        ascending?: boolean;
        nullsFirst?: boolean;
      },
      limit?: {
        count: number;
        foreignTable?: string;
      },
    ) {
      const headers = access_token ? {
        global: { headers: { Authorization: `bearer ${access_token}` } },
      } : undefined
      const client = createClient(auth.url, auth.key, headers);
      const options = (head || count) ? { head, count } : undefined;
      let query = client.from(table).select(columns || undefined, options);
      if (filter?.column) {
        query = query.filter(filter.column, filter.operator, filter.value);
      }
      if (order?.column) {
        const { column, ...options } = order;
        query = query.order(column, options);
      }
      if (limit?.count) {
        const { count, foreignTable } = limit;
        query = query.limit(count, foreignTable ? { foreignTable } : undefined);
      }
    
      return await query;
    }
    

    Submitted by adam186 1163 days ago

  • deno
    import { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
    
    /**
     * @param count Count algorithm to use to count rows in the table or view.
     * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the hood.
     * `"planned"`: Approximated but fast count algorithm. Uses the Postgres statistics under the hood.
     * `"estimated"`: Uses exact count for low numbers and planned count for high numbers.
     *
     * @param head When set to `true`, `data` will not be returned.
     * Useful if you only need the count.
     * 
     * @param filter Learn more at https://supabase.com/docs/reference/javascript/filter
     * 
     * @param order Learn more at https://supabase.com/docs/reference/javascript/order
     * 
     * @param limit Learn more at https://supabase.com/docs/reference/javascript/limit
     */
    export async function main(
      auth: Resource<"supabase">,
      table: string,
      columns?: string,
      count?: "exact" | "planned" | "estimated",
      head?: boolean,
      filter?: {
        column: string;
        operator: string;
        value: any;
      },
      order?: {
        column: string;
        foreignTable: string;
        ascending?: boolean;
        nullsFirst?: boolean;
      },
      limit?: {
        count: number;
        foreignTable?: string;
      },
    ) {
      const client = createClient(auth.url, auth.key);
      const options = (head || count) ? { head, count } : undefined;
      let query = client.from(table).select(columns || undefined, options);
      if (filter?.column) {
        query = query.filter(filter.column, filter.operator, filter.value);
      }
      if (order?.column) {
        const { column, ...options } = order;
        query = query.order(column, options);
      }
      if (limit?.count) {
        const { count, foreignTable } = limit;
        query = query.limit(count, foreignTable ? { foreignTable } : undefined);
      }
    
      return await query;
    }
    

    Submitted by admin 1179 days ago

  • deno
    import { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
    
    /**
     * @param count Count algorithm to use to count rows in the table or view.
     * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the hood.
     * `"planned"`: Approximated but fast count algorithm. Uses the Postgres statistics under the hood.
     * `"estimated"`: Uses exact count for low numbers and planned count for high numbers.
     *
     * @param head When set to `true`, `data` will not be returned.
     * Useful if you only need the count.
     * 
     * @param filter Learn more at https://supabase.com/docs/reference/javascript/filter
     * 
     * @param order Learn more at https://supabase.com/docs/reference/javascript/order
     * 
     * @param limit Learn more at https://supabase.com/docs/reference/javascript/limit
     */
    export async function main(
      auth: Resource<"supabase">,
      table: string,
      columns?: string,
      count?: "exact" | "planned" | "estimated",
      head?: boolean,
      filter?: {
        column: string;
        operator: string;
        value: any;
      },
      order?: {
        column: string;
        foreignTable: string;
        ascending?: boolean;
        nullsFirst?: boolean;
      },
      limit?: {
        count: number;
        foreignTable?: string;
      },
    ) {
      const client = createClient(auth.supabaseUrl, auth.supabaseKey);
      const options = (head || count) ? { head, count } : undefined;
      let query = client.from(table).select(columns || undefined, options);
      if (filter?.column) {
        query = query.filter(filter.column, filter.operator, filter.value);
      }
      if (order?.column) {
        const { column, ...options } = order;
        query = query.order(column, options);
      }
      if (limit?.count) {
        const { count, foreignTable } = limit;
        query = query.limit(count, foreignTable ? { foreignTable } : undefined);
      }
    
      return await query;
    }
    

    Submitted by adam186 1190 days ago

  • deno
    import { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
    
    /**
     * @param count Count algorithm to use to count rows in the table or view.
     * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the hood.
     * `"planned"`: Approximated but fast count algorithm. Uses the Postgres statistics under the hood.
     * `"estimated"`: Uses exact count for low numbers and planned count for high numbers.
     *
     * @param head When set to `true`, `data` will not be returned.
     * Useful if you only need the count.
     * 
     * @param filter Learn more at https://supabase.com/docs/reference/javascript/filter
     * 
     * @param order Learn more at https://supabase.com/docs/reference/javascript/order
     * 
     * @param limit Learn more at https://supabase.com/docs/reference/javascript/limit
     */
    export async function main(
      auth: Resource<"supabase">,
      table: string,
      columns?: string,
      count?: "exact" | "planned" | "estimated",
      head?: boolean,
      filter?: {
        column: string;
        operator: string;
        value: any;
      },
      order?: {
        column: string;
        foreignTable: string;
        ascending?: boolean;
        nullsFirst?: boolean;
      },
      limit?: {
        count: number;
        foreignTable?: string;
      },
    ) {
      const client = createClient(auth.supabaseUrl, auth.supabaseKey);
      const options = (head || count) ? { head, count } : undefined;
      let query = client.from(table).select(columns || undefined, options);
      if (filter?.column) {
        query = query.filter(filter.column, filter.operator, filter.value);
      }
      if (order?.column) {
        const { column, ...options } = order;
        query = query.order(column, options);
      }
      if (limit?.count) {
        const { count, foreignTable } = limit;
        query = query.limit(count, foreignTable ? { foreignTable } : undefined);
      }
    
      return await query;
    }
    

    Submitted by adam186 1229 days ago

  • deno
    import { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
    
    /**
     * @param count Count algorithm to use to count rows in the table or view.
     * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the hood.
     * `"planned"`: Approximated but fast count algorithm. Uses the Postgres statistics under the hood.
     * `"estimated"`: Uses exact count for low numbers and planned count for high numbers.
     *
     * @param head When set to `true`, `data` will not be returned.
     * Useful if you only need the count.
     * 
     * @param filter Learn more at https://supabase.com/docs/reference/javascript/filter
     * 
     * @param order Learn more at https://supabase.com/docs/reference/javascript/order
     * 
     * @param limit Learn more at https://supabase.com/docs/reference/javascript/limit
     */
    export async function main(
      auth: Resource<"supabase">,
      table: string,
      columns?: string,
      count?: "exact" | "planned" | "estimated",
      head?: boolean,
      filter?: {
        column: string;
        operator: string;
        value: any;
      },
      order?: {
        column: string;
        foreignTable: string;
        ascending?: boolean;
        nullsFirst?: boolean;
      },
      limit?: {
        count: number;
        foreignTable?: string;
      },
    ) {
      const client = createClient(auth.supabaseUrl, auth.supabaseKey);
      const options = (head || count) ? { head, count } : undefined;
      let query = client.from(table).select(columns || undefined, options);
      if (filter?.column) {
        query = query.filter(filter.column, filter.operator, filter.value);
      }
      if (order?.column) {
        const { column, ...options } = order;
        query = query.order(column, options);
      }
      if (limit?.count) {
        const { count, ...options } = limit;
        query = query.limit(count, options);
      }
    
      return await query;
    }
    

    Submitted by adam186 1229 days ago