Documentation
¶
Index ¶
- Constants
- Variables
- type DirectMessage
- type GroupChat
- type Message
- type User
- func (u *User) CreateDirectMessage(user2ID string) (chat *DirectMessage, err error)
- func (u *User) CreateGroupChat() (chat *GroupChat, err error)
- func (u *User) HandleAccess(dataSubjectId string, currentDocumentID string) map[string]interface{}
- func (u *User) HandleDeletion(dataSubjectId string) (nodesToTraverse []pal.Locator, deleteNode bool, ...)
- func (u *User) JoinOrQuitGroupChat(chatID string, action joinQuitAction) (err error)
- func (u *User) SendMessageToDirectMessage(chatID string, message string) error
- func (u *User) SendMessageToGroupChat(chatID string, message string) error
Constants ¶
View Source
const ( FirestoreUsersCollection = "users" FirestoreGroupChatCollection = "gcs" FirestoreDirectMessagesCollection = "dms" FirestoreMessagesCollection = "messages" )
View Source
const ( JoinChat joinQuitAction = "join" QuitChat joinQuitAction = "quit" )
Variables ¶
View Source
var App *firebaseSDK.App
App is a global variable to hold the initialized Firebase App object
View Source
var Context context.Context
Functions ¶
This section is empty.
Types ¶
type DirectMessage ¶
type DirectMessage struct { ID string `firestore:"id,omitempty"` User1 string `firestore:"user1"` User2 string `firestore:"user2"` Messages []Message `firestore:"-"` // subcollection }
func GetDirectMessage ¶
func GetDirectMessage(ID string) (chat *DirectMessage, err error)
type GroupChat ¶
type GroupChat struct { ID string `firestore:"id,omitempty"` Owner string `firestore:"owner"` Users []string `firestore:"users"` Messages []Message `firestore:"-"` // subcollection }
func GetGroupChat ¶
func (*GroupChat) HandleAccess ¶
type Message ¶
type Message struct { ID string `firestore:"id,omitempty"` UserID string `firestore:"userId"` Content string `firestore:"content"` Timestamp time.Time `firestore:"timestamp"` }
func (*Message) HandleAccess ¶
type User ¶
type User struct { ID string `firestore:"id,omitempty"` Name string `firestore:"name"` GCs []string `firestore:"gcs"` DMs map[string]string `firestore:"dms"` // map from other user id to dm id }
func CreateUser ¶
func (*User) CreateDirectMessage ¶
func (u *User) CreateDirectMessage(user2ID string) (chat *DirectMessage, err error)
func (*User) CreateGroupChat ¶
func (*User) HandleAccess ¶
func (*User) HandleDeletion ¶
func (*User) JoinOrQuitGroupChat ¶
func (*User) SendMessageToDirectMessage ¶
Click to show internal directories.
Click to hide internal directories.