controller property

EventsCtrl<EventFractal> controller
final

Implementation

static final controller = EventsCtrl(
  extend: Fractal.controller,
  make: (d) async {
    return switch (d) {
      MP() => EventFractal.fromMap(d),
      null || Object() => throw ('wrong event type')
    };
  },
  attributes: [
    Attr(
      name: 'hash',
      format: FormatF.text,
      isIndex: true,
      isUnique: true,
    ),
    Attr(
      name: 'owner',
      format: FormatF.reference,
      isIndex: true,
      canNull: true,
      isImmutable: true,
    ),
    Attr(
      name: 'pubkey',
      format: FormatF.text,
      isImmutable: true,
    ),
    Attr(
      name: 'created_at',
      format: FormatF.integer,
      isImmutable: true,
      isIndex: true,
    ),
    Attr(
      name: 'content',
      format: FormatF.text,
      def: '',
      isImmutable: true,
    ),
    ...Consumable.attrs,
    Attr(
      name: 'sig',
      format: FormatF.text,
    ),
    Attr(
      name: 'sync_at',
      format: FormatF.integer,
    ),
  ],
);