-
Notifications
You must be signed in to change notification settings - Fork 383
Expand file tree
/
Copy pathdraft_messages.dart
More file actions
58 lines (43 loc) · 2.08 KB
/
Copy pathdraft_messages.dart
File metadata and controls
58 lines (43 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// coverage:ignore-file
import 'package:drift/drift.dart';
import 'package:stream_chat_persistence/src/converter/converter.dart';
import 'package:stream_chat_persistence/src/entity/channels.dart';
import 'package:stream_chat_persistence/src/entity/messages.dart';
/// Represents a [DraftMessages] table in [DriftChatDatabase].
@DataClassName('DraftMessageEntity')
class DraftMessages extends Table {
/// The message id
TextColumn get id => text()();
/// The text of this message
TextColumn get messageText => text().nullable()();
/// The list of attachments, either provided by the user
/// or generated from a command or as a result of URL scraping.
TextColumn get attachments => text().map(ListConverter<String>())();
/// The message type
TextColumn get type => text().withDefault(const Constant('regular'))();
/// The list of user mentioned in the message
TextColumn get mentionedUsers => text().map(ListConverter<String>())();
/// The ID of the parent message, if the message is a thread reply.
TextColumn get parentId => text()
.nullable()
.references(Messages, #id, onDelete: KeyAction.cascade)();
/// The ID of the quoted message, if the message is a quoted reply.
TextColumn get quotedMessageId => text().nullable()();
/// The ID of the poll, if the message is a poll.
TextColumn get pollId => text().nullable()();
/// Check if this message needs to show in the channel.
BoolColumn get showInChannel => boolean().nullable()();
/// A used command name.
TextColumn get command => text().nullable()();
/// If true the message is silent
BoolColumn get silent => boolean().withDefault(const Constant(false))();
/// The DateTime on which the message was created.
DateTimeColumn get createdAt => dateTime().withDefault(currentDateAndTime)();
/// The channel cid of which this message is part of
TextColumn get channelCid =>
text().references(Channels, #cid, onDelete: KeyAction.cascade)();
/// Message custom extraData
TextColumn get extraData => text().nullable().map(MapConverter())();
@override
Set<Column> get primaryKey => {id};
}