Collection model class.

const collection = new Collection({
name: "article",
type: "base",
listRule: "@request.auth.id != '' || status = 'public'",
viewRule: "@request.auth.id != '' || status = 'public'",
deleteRule: "@request.auth.id != ''",
schema: [
{
name: "title",
type: "text",
required: true,
options: { min: 6, max: 100 },
},
{
name: "description",
type: "text",
},
]
})

Hierarchy

Implements

Constructors

Methods

  • DecodeOptions decodes the current collection options into the provided "result" (must be a pointer).

    Parameters

    • result: any

    Returns void

  • IsNew indicates what type of db query (insert or update) should be used with the model instance.

    Returns boolean

  • NormalizeOptions updates the current collection options with a new normalized state based on the collection type.

    Returns void

  • PostScan implements the [dbx.PostScanner] interface.

    It is executed right after the model was populated with the db row values.

    Returns void

  • RefreshId generates and sets a new model id.

    The generated id is a cryptographically random 15 characters length string.

    Returns void

  • SetId sets the model id to the provided string value.

    Parameters

    • id: string

    Returns void

  • SetOptions normalizes and unmarshals the specified options into m.Options.

    Parameters

    • typedOptions: any

    Returns void

Properties

createRule?: string
created: types.DateTime
deleteRule?: string
id: string
indexes: JsonArray<string>
listRule?: string

rules

name: string
options: JsonMap
schema: schema.Schema
system: boolean
type: string
updateRule?: string
updated: types.DateTime
viewRule?: string

Generated using TypeDoc