models

package
v0.0.0-...-05e4c81 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtAuthCredentials

type ExtAuthCredentials struct {
	Code string `json:"code"`
}

type MemberInfo

type MemberInfo struct {
	ID         string    `json:"id" bson:"_id"`
	RoomID     string    `json:"room" bson:"room"`
	MemberID   string    `json:"member" bson:"member"`
	JoinedAt   Timestamp `json:"joinedAt" bson:"joinedAt"`     // marker to start reading messages from
	LastReadAt Timestamp `json:"lastReadAt" bson:"lastReadAt"` // marker to notify about the new messages
}

Structure describes particular room membership I.e. if user exits private chat the second participant still can see the chat log and current member while current user don't see the chat until its participant starts writing into it by initiating new conversation fur the current user

type Message

type Message struct {
	ID        string            `json:"id" bson:"_id"`
	RoomID    string            `json:"room" bson:"room"`
	FromID    string            `json:"from" bson:"from"`
	Timestamp Timestamp         `json:"timestamp" bson:"timestamp"`
	Type      string            `json:"type" bson:"-"`
	Body      string            `json:"body" bson:"body"`
	Reactions map[string]string `json:"reactions,omitempty" bson:"reactions,omitempty"`
}

type Room

type Room struct {
	ID         string     `json:"id" bson:"_id"`
	OwnerID    string     `json:"owner" bson:"owner"`
	Members    []string   `json:"members" bson:"members"`
	Created    Timestamp  `json:"created" bson:"created"`
	Updated    Timestamp  `json:"updated" bson:"updated"`
	MemberInfo MemberInfo `json:"memberInfo" bson:"-"`
}

type Timestamp

type Timestamp time.Time

func (Timestamp) GetBSON

func (t Timestamp) GetBSON() (interface{}, error)

func (*Timestamp) MarshalJSON

func (t *Timestamp) MarshalJSON() ([]byte, error)

func (*Timestamp) SetBSON

func (t *Timestamp) SetBSON(raw bson.Raw) error

func (*Timestamp) String

func (t *Timestamp) String() string

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(b []byte) error

type Token

type Token struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int32  `json:"expires_in"`
}

type User

type User struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	AvatarURL string `json:"avatarUrl,omitempty"`
}

type UserList

type UserList struct {
	Data []User `json:"data"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL