Interface IDb

interface IDb {
    add: (
        data: { data: string; dataType?: string; searchText?: string },
    ) => Promise<void>;
    delete: (dataId: number) => Promise<void>;
    deleteAll: () => Promise<void>;
    retrieveAll: (
        options: { fields?: ("data" | "search_text")[] },
    ) => Promise<
        {
            createdAt: Date;
            data?: string;
            dataId: number;
            dataType: string;
            extId: number;
            searchText?: string;
            updatedAt: Date;
        }[],
    >;
    retrieveAllByType: (
        dataType: string,
    ) => Promise<
        {
            createdAt: Date;
            data?: string;
            dataId: number;
            dataType: string;
            extId: number;
            searchText?: string;
            updatedAt: Date;
        }[],
    >;
    search: (
        searchParams: {
            afterCreatedAt?: Date;
            beforeCreatedAt?: Date;
            dataId?: number;
            dataType?: string;
            fields?: ("data" | "search_text")[];
            limit?: number;
            orderByCreatedAt?: EnumValues<typeof SQLSortOrderEnum>;
            orderByUpdatedAt?: EnumValues<typeof SQLSortOrderEnum>;
            searchMode?: EnumValues<typeof SearchModeEnum>;
            searchText?: string;
        },
    ) => Promise<
        {
            createdAt: Date;
            data?: string;
            dataId: number;
            dataType: string;
            extId: number;
            searchText?: string;
            updatedAt: Date;
        }[],
    >;
    update: (
        data: { data: string; dataId: number; searchText?: string },
    ) => Promise<void>;
}

Properties

add: (
    data: { data: string; dataType?: string; searchText?: string },
) => Promise<void>
delete: (dataId: number) => Promise<void>
deleteAll: () => Promise<void>

Type declaration

    • (): Promise<void>
    • Delete all data of this extension.

      Returns Promise<void>

retrieveAll: (
    options: { fields?: ("data" | "search_text")[] },
) => Promise<
    {
        createdAt: Date;
        data?: string;
        dataId: number;
        dataType: string;
        extId: number;
        searchText?: string;
        updatedAt: Date;
    }[],
>

Type declaration

    • (
          options: { fields?: ("data" | "search_text")[] },
      ): Promise<
          {
              createdAt: Date;
              data?: string;
              dataId: number;
              dataType: string;
              extId: number;
              searchText?: string;
              updatedAt: Date;
          }[],
      >
    • Retrieve all data of this extension. Use search() method for more advanced search.

      Parameters

      • options: { fields?: ("data" | "search_text")[] }

        optional fields to retrieve. By default, data and searchText are not returned.

      Returns Promise<
          {
              createdAt: Date;
              data?: string;
              dataId: number;
              dataType: string;
              extId: number;
              searchText?: string;
              updatedAt: Date;
          }[],
      >

retrieveAllByType: (
    dataType: string,
) => Promise<
    {
        createdAt: Date;
        data?: string;
        dataId: number;
        dataType: string;
        extId: number;
        searchText?: string;
        updatedAt: Date;
    }[],
>

Type declaration

    • (
          dataType: string,
      ): Promise<
          {
              createdAt: Date;
              data?: string;
              dataId: number;
              dataType: string;
              extId: number;
              searchText?: string;
              updatedAt: Date;
          }[],
      >
    • Retrieve all data of this extension by type. Use search() method for more advanced search.

      Parameters

      • dataType: string

      Returns Promise<
          {
              createdAt: Date;
              data?: string;
              dataId: number;
              dataType: string;
              extId: number;
              searchText?: string;
              updatedAt: Date;
          }[],
      >

search: (
    searchParams: {
        afterCreatedAt?: Date;
        beforeCreatedAt?: Date;
        dataId?: number;
        dataType?: string;
        fields?: ("data" | "search_text")[];
        limit?: number;
        orderByCreatedAt?: EnumValues<typeof SQLSortOrderEnum>;
        orderByUpdatedAt?: EnumValues<typeof SQLSortOrderEnum>;
        searchMode?: EnumValues<typeof SearchModeEnum>;
        searchText?: string;
    },
) => Promise<
    {
        createdAt: Date;
        data?: string;
        dataId: number;
        dataType: string;
        extId: number;
        searchText?: string;
        updatedAt: Date;
    }[],
>
update: (
    data: { data: string; dataId: number; searchText?: string },
) => Promise<void>

Type declaration

    • (data: { data: string; dataId: number; searchText?: string }): Promise<void>
    • Update data and searchText of this extension.

      Parameters

      • data: { data: string; dataId: number; searchText?: string }

      Returns Promise<void>