Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface NamedSchema<DBNames, Versions, DBSchema>

The schema for the database, along with the allowed names for databases using that schema.

Bear in mind that defining the schema alone won't set the database up with that schema. It's used for providing type safety for interacting with the database.

Use this interface by providing the generic type parameters, rather than relying on type inference, for best results.

See Database.open for how to set a database up.

type MySchema = NamedSchema<
  "myDatabase" | "myOtherDatabase",
  3,
  {
    favouriteColour: {
      key: string;
      value: {
        r: number;
        g: number;
        b: number;
      };
    };
  }
>

Type parameters

  • DBNames: string

  • Versions: number

  • DBSchema: Schema

Hierarchy

  • NamedSchema

Index

Properties

Properties

dbNames

dbNames: DBNames

The database names permitted to use this schema.

schema

schema: DBSchema

The database schema.

versions

versions: Versions

The versions of the database this schema represents.

Generated using TypeDoc