Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/cotton/deps.ts>MysqlClient

SQL Database Toolkit for Deno
Latest
class MysqlClient
import { MysqlClient } from "https://deno.land/x/cotton@v0.7.5/deps.ts";

MySQL client

Properties

private
optional
_pool: ConnectionPool
config: ClientConfig
readonly
pool

get pool info

Methods

private
createConnection(): Promise<PoolConnection>

close connection

connect(config: ClientConfig): Promise<Client>

connect to database

execute(sql: string, params?: any[]): Promise<ExecuteResult>

excute sql

query(sql: string, params?: any[]): Promise<any>

excute query sql

transaction<T = any>(processor: TransactionProcessor<T>): Promise<T>

Execute a transaction process, and the transaction successfully returns the return value of the transaction process

useConnection<T>(fn: (conn: Connection) => Promise<T>)