Edits history of script submission #319 for ' Run Arbitrary Query (surrealdb)'

  • deno
    One script reply has been approved by the moderators
    Ap­pro­ved
    import Surreal from "https://deno.land/x/[email protected]/mod.ts";
    
    /**
     * @param query The query string.
     * @param variables The variables used in the query.
     */
    type Surrealdb = {
      url: string;
      token: string;
    };
    export async function main(
      auth: Surrealdb,
      namespace: string,
      database: string,
      query: string,
      variables?: Record<string, unknown>,
    ) {
      const client = new Surreal(auth.url, auth.token);
      await client.use(namespace, database);
      const result = await client.query(query, variables);
      client.close();
      return result;
    }
    

    Submitted by hugo697 386 days ago

  • deno
    import Surreal from "https://deno.land/x/[email protected]/mod.ts";
    
    /**
     * @param query The query string.
     * @param variables The variables used in the query.
     */
    type Surrealdb = {
      url: string;
      token: string;
    };
    export async function main(
      auth: Surrealdb,
      namespace: string,
      database: string,
      query: string,
      variables?: Record<string, unknown>,
    ) {
      const client = new Surreal(auth.url, auth.token);
      await client.use(namespace, database);
      const result = await client.query(query, variables);
      client.close();
      return result;
    }
    

    Submitted by admin 1018 days ago

  • deno
    import Surreal from 'https://deno.land/x/[email protected]/mod.ts'
    
    /**
     * @param query The query string.
     * @param variables The variables used in the query.
     */
    type Surrealdb = {
      url: string;
      token: string;
    };
    export async function main(
      auth: Surrealdb,
      namespace: string,
      database: string,
      query: string,
      variables?: Record<string, unknown>
    ) {
    	const client = new Surreal(auth.url, auth.token)
    	await client.use(namespace, database)
    	const result = await client.query(query, variables)
    	client.close()
    	return result
    }
    

    Submitted by admin 1021 days ago

  • deno
    import type { Resource } from 'https://deno.land/x/[email protected]/mod.ts'
    import Surreal from 'https://deno.land/x/[email protected]/mod.ts'
    
    /**
     * @param query The query string.
     * @param variables The variables used in the query.
     */
    export async function main(
      auth: Resource<'surrealdb'>,
      namespace: string,
      database: string,
      query: string,
      variables?: Record<string, unknown>
    ) {
    	const client = new Surreal(auth.url, auth.token)
    	await client.use(namespace, database)
    	const result = await client.query(query, variables)
    	client.close()
    	return result
    }
    

    Submitted by adam186 1144 days ago

  • deno
    import type { Resource } from 'https://deno.land/x/[email protected]/mod.ts'
    import Surreal from 'https://deno.land/x/[email protected]/mod.ts'
    
    /**
     * @param query The query string.
     * @param variables The variables used in the query.
     */
    async function main(
      auth: Resource<'surrealdb'>,
      namespace: string,
      database: string,
      query: string,
      variables?: Record<string, unknown>
    ) {
    	const client = new Surreal(auth.url, auth.token)
    	await client.use(namespace, database)
    	const result = await client.query(query, variables)
    	client.close()
    	return result
    }
    

    Submitted by adam186 1144 days ago