Skip to content

Commit

Permalink
Add indexNoteStart
Browse files Browse the repository at this point in the history
  • Loading branch information
steida committed Mar 21, 2024
1 parent b029afd commit 66c8587
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/DayNotes.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ExtractRow, NotNull, cast, useQuery } from "@evolu/react";
import { create, props } from "@stylexjs/stylex";
import { ReadonlyArray, pipe } from "effect";
import { FC, memo, useMemo, useState } from "react";
import { Temporal } from "temporal-polyfill";
import { evolu } from "../lib/Db";
Expand All @@ -12,7 +13,6 @@ import { EditorOneLine } from "./EditorOneLine";
import { Formatted } from "./Formatted";
import { Link } from "./Link";
import { NoteDialog } from "./NoteDialog";
import { ReadonlyArray, pipe } from "effect";

const notesByDay = (startOfDay: SqliteDateTime, endOfDay: SqliteDateTime) =>
evolu.createQuery((db) =>
Expand Down
11 changes: 9 additions & 2 deletions lib/Db.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as S from "@effect/schema/Schema";
import * as Evolu from "@evolu/react";
import { createEvolu, database, id, table } from "@evolu/react";
import { SqliteDateTime } from "./temporal/castTemporal";
import { Content, ContentMax10k } from "./Lexical";
import { SqliteDateTime } from "./temporal/castTemporal";

export const NoteId = id("Note");
export type NoteId = S.Schema.Type<typeof NoteId>;
Expand Down Expand Up @@ -34,5 +34,12 @@ const Database = database({
});
export type Database = S.Schema.Type<typeof Database>;

export const evolu = createEvolu(Database);
const indexes = [
Evolu.createIndex("indexNoteStart").on("note").column("start"),
];

export const evolu = createEvolu(Database, {
name: "Evolu.me",
indexes,
});
export const useEvolu = Evolu.useEvolu<Database>;

0 comments on commit 66c8587

Please sign in to comment.