CRUD service handling basic database operations

Constructors

Methods

Constructors

Methods

  • Create a new record in the specified table

    Parameters

    • table: string

      Table name

    • data: Record<string, any>

      Data to insert

    Returns Promise<Result<any>>

    Promise resolving to Result with created record

  • Read a record by ID from the specified table

    Parameters

    • table: string

      Table name

    • id: string

      Record ID

    Returns Promise<Result<any>>

    Promise resolving to Result with record or null

  • Update a record by ID in the specified table

    Parameters

    • table: string

      Table name

    • id: string

      Record ID

    • data: Record<string, any>

      Data to update

    Returns Promise<Result<any>>

    Promise resolving to Result with updated record

  • Delete a record by ID from the specified table

    Parameters

    • table: string

      Table name

    • id: string

      Record ID

    Returns Promise<Result<void>>

    Promise resolving to Result indicating success or failure

  • List records from the specified table with optional basic filtering

    Parameters

    • table: string

      Table name

    • Optional filters: Record<string, any>

      Optional filters to apply

    Returns Promise<Result<any[]>>

    Promise resolving to Result with array of records