Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatRepository ¶
type Device ¶
type Device struct { ID int `json:"id" gorm:"primaryKey" example:"1"` UserID int `json:"userId" example:"1"` Type string `json:"type" example:"web"` // web, android, ios Name string `json:"name" example:"Chrome 90.0.4430.212 (Linux x86_64)"` Token string `` /* 186-byte string literal not displayed */ CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` }
type Message ¶
type Message struct { ID int `json:"id" gorm:"primaryKey" example:"1"` Type string `json:"type" example:"text"` // text, error, system ChatID int `json:"chatId,omitempty" gorm:"foreignKey:ChatID" example:"1"` Content string `json:"content" example:"bla-bla-bla"` SenderID int `json:"senderId,omitempty" gorm:"foreignKey:SenderID" example:"2"` Sender User `json:"sender,omitempty"` Status string `json:"status,omitempty" example:"sent"` // sent, delivered, read CreatedAt int64 `json:"createdAt,omitempty" example:"1620000000"` }
type MessageRepository ¶
type User ¶
type User struct { ID int `json:"id" gorm:"primaryKey" example:"1"` Username string `json:"username" gorm:"unique" example:"username"` Password string `json:"-"` Image string `json:"image" example:"image.png"` FollowedUsers []*User `json:"followedUsers,omitempty" gorm:"many2many:followed_users"` BlockedUsers []*User `json:"blockedUsers,omitempty" gorm:"many2many:blocked_users"` Chats []*Chat `json:"chats,omitempty" gorm:"many2many:chat_users"` Devices []*Device `json:"devices,omitempty"` IsOnline bool `json:"isOnline,omitempty" gorm:"default:false" example:"true"` CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"updatedAt,omitempty" example:"2024-01-01T12:00:00.000Z"` }
type UserRepository ¶
type UserRepository interface { FindAll() (*[]User, error) FindByID(id int) (*User, error) FindByUsername(username string) (*User, error) FindArrayByPartUsername(username string, order string, limit int) (*[]User, error) Create(user *User) error Update(user *User) error UpdateWithAssociations(user *User) error Delete(user *User) error ReplaceFollowedUsers(user *User, followedUsers []*User) error ReplaceBlockedUsers(user *User, blockedUsers []*User) error ResetPassword(user *User, password string) error PasswordMatches(user *User, plainText string) (bool, error) }
Click to show internal directories.
Click to hide internal directories.