Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
Conn maintains a connection to the database.
type Member ¶
type Member struct { ID int64 `json:"id"` UserID int64 `gorm:"not null" json:"-"` User *User `gorm:"constraint:OnDelete:CASCADE" json:"user,omitempty"` RoomID int64 `gorm:"not null" json:"-"` Room *Room `gorm:"constraint:OnDelete:CASCADE" json:"room"` IsOwner bool `gorm:"not null" json:"is_owner"` IsAdmin bool `gorm:"not null" json:"is_admin"` }
Member represents a member of a specific room.
type Message ¶
type Message struct { ID int64 `json:"id"` MemberID int64 `gorm:"not null" json:"-"` Member *Member `gorm:"constraint:OnDelete:CASCADE" json:"member"` Body string `gorm:"not null" json:"body"` CreationDate time.Time `gorm:"not null" json:"creation_date"` StarCount int64 `gorm:"not null" json:"star_count"` Stars []*User `gorm:"many2many:message_stars;" json:"-"` IsEdited bool `gorm:"not null" json:"is_edited"` }
Message represents an individual message.
type Room ¶
type Room struct { ID int64 `json:"id"` Name string `gorm:"not null" json:"name"` CreationDate time.Time `gorm:"not null" json:"creation_date"` }
Room represents a chat group.
type User ¶
type User struct { ID int64 `json:"id"` Username string `gorm:"not null;uniqueIndex" json:"username"` Password string `gorm:"not null" json:"-"` Email string `gorm:"not null" json:"email"` IsActive bool `gorm:"not null" json:"is_active"` }
User represents a registered user.
func (*User) Authenticate ¶
Authenticate compares the provided password to the one stored in the database. An error is returned if the values do not match.
func (*User) SetPassword ¶
SetPassword salts and hashes the user's password. It does not store the new value in the database.
Click to show internal directories.
Click to hide internal directories.