edgekitjs - v0.0.51

    Class TableEntityAbstract

    A table entity represents a single row in a database table.

    Table entities are backed by a database table, and are typically used to represent domain objects that are persisted to the database.

    Hierarchy (View Summary)

    Index

    Accessors

    Methods

    Constructors

    • Parameters

      • parser: ObjectParser

      Returns TableEntity

    Properties

    parser: ObjectParser

    Accessors

    Methods

    • Converts the Data object into a plain JSON representation, including all properties defined as getters in the subclass.

      The toJSON method dynamically identifies getter properties in the subclass and collects their values to construct a JSON object. This is particularly useful when you want to serialize the Data object for APIs, logging, or other use cases requiring JSON format.

      Returns Record<string, unknown>

      A plain object representing the Data instance with all getter properties.

      class LoginData extends Data<FormParser> {
      get username() {
      return this.parser.getString("username");
      }
      get password() {
      return this.parser.getString("password");
      }
      }

      const loginData = new LoginData(new FormParser(formData));
      console.log(JSON.stringify(loginData.toJSON()));
      // Output: { "username": "johndoe", "password": "secret" }
    • Type Parameters

      • T extends Table<TableConfig<Column<any, object, object>>>
      • M extends TableEntity

      Parameters

      • this: new (parser: ObjectParser) => M
      • data: T["$inferSelect"]

      Returns M

    • Type Parameters

      • T extends Table<TableConfig<Column<any, object, object>>>
      • M extends TableEntity

      Parameters

      • this: new (parser: ObjectParser) => M
      • data: T["$inferSelect"][]

      Returns M[]

    MMNEPVFCICPMFPCPTTAAATR