Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

Hierarchy

  • MySQLHandler

Index

Properties

parser: { key: (key: string) => string; keyVal: (dataObj: Record<string, any>) => string[] } = ...

Type declaration

  • key: (key: string) => string
      • (key: string): string
      • description

        Put a templated string around the key for SQL to identified it as a structure name, not a value

        Parameters

        • key: string

        Returns string

  • keyVal: (dataObj: Record<string, any>) => string[]
      • (dataObj: Record<string, any>): string[]
      • description

        Parsing object keys and it values to SQL key and value format and mapping it into a string format

        Parameters

        • dataObj: Record<string, any>

        Returns string[]

utils: { executeQuery: (query: string) => Promise<any>; validateQueryObject: (obj: any, requiredKey?: string[]) => boolean; validateQueryObjectData: (key: string, data: any) => boolean } = ...

Type declaration

  • executeQuery: (query: string) => Promise<any>
      • description

        Executing database query in promise

        example
        executeQuery("SELECT * FROM `users`")
        

        Parameters

        • query: string

        Returns Promise<any>

  • validateQueryObject: (obj: any, requiredKey?: string[]) => boolean
      • (obj: any, requiredKey?: string[]): boolean
      • description

        Validating query object before starting to execute it

        Parameters

        • obj: any
        • requiredKey: string[] = []

        Returns boolean

  • validateQueryObjectData: (key: string, data: any) => boolean
      • (key: string, data: any): boolean
      • description

        Validating object data whether if it's object or not

        Parameters

        • key: string
        • data: any

        Returns boolean

Methods

  • description

    Update a data from database table

    example
    // Normal Version.
    db.users.update({
    where: {
    name: "Don Chad"
    },
    data: {
    name: "John Doe"
    }
    })

    // Function Delivered Version.
    db.users.update({
    where: {
    name: "Don Chad"
    },
    data: (data) => {
    // MUST RETURNS as an OBJECT
    return {
    count: data.count += 1
    }
    }
    })

    Parameters

    Returns Promise<any>

Generated using TypeDoc