models

package
v0.0.0-...-389bc3b Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoMigrate

func AutoMigrate()

AutoMigrate 自动迁移数据库 注意: 不会删除字段或索引,对于过期的字段或索引需要手动删除

Types

type Attendee

type Attendee struct {
	UserID uint `json:"user_id" gorm:"unique_index:room_user"`
	RoomID uint `json:"room_id" gorm:"unique_index:room_user"`
}

Attendee 会议出席者

type Message

type Message struct {
	ID      uint   `json:"id" gorm:"primary_key"`
	UUID    string `json:"uuid"`
	RoomID  uint   `json:"room_id"`
	UserID  uint   `json:"user_id"`
	Content string `json:"content" gorm:"size:255"`
	Time    int64  `json:"time"`
}

Message IM

type Room

type Room struct {
	ID              uint                 `json:"id"               gorm:"primary_key"`
	UUID            string               `json:"uuid"             gorm:"unique_index;size:24"` // 房间对外的 UUID
	Name            string               `json:"name"             gorm:"size:128"`             // 自定义房间名称
	Private         bool                 `json:"private"`                                      // 是否为私密房间
	State           string               `json:"state"`                                        // 房间状态: active, archived
	Owner           uint                 `json:"owner"            gorm:"index"`                // 管理员
	RTC             string               `json:"-"                gorm:"size:128"`             // RTC RoomName: 房间名称,保持跟 UUID 一致
	RTCToken        string               `json:"rtc_token"        gorm:"-"`                    // RTC RoomToken
	Whiteboard      string               `json:"whiteboard_id"    gorm:"size:128"`             // 白板房间 ID
	WhiteboardToken string               `json:"whiteboard_token" gorm:"-"`                    // 白板房间 token
	CreatedAt       timestamp.Timestamp  `json:"created_at"`
	UpdatedAt       timestamp.Timestamp  `json:"updated_at"`
	DeletedAt       *timestamp.Timestamp `json:"deleted_at,omitempty"`

	Attendees []Attendee `json:"attendees"` // 参会人员
}

Room 房间

type User

type User struct {
	ID                uint                 `json:"id"                 gorm:"primary_key"`           // 主键
	Email             string               `json:"email"              gorm:"size:128;default:null"` // 邮箱
	Name              string               `json:"name"               gorm:"size:128"`              // 昵称
	Avatar            string               `json:"avatar"`                                          // 头像 Etag
	Gender            string               `json:"gender"             gorm:"size:10"`               // 性别
	Birthday          *timestamp.Timestamp `json:"birthday"`                                        // 生日
	Bio               string               `json:"bio"`                                             // 个人简介
	RegisteredIP      string               `json:"registered_ip"      gorm:"size:128"`              // 注册 IP
	Password          string               `json:"password,omitempty" sql:"-"`                      // 密码
	EncryptedPassword []byte               `json:"-"`                                               // 加密密钥
	CurrentSignInAt   timestamp.Timestamp  `json:"current_sign_in_at"`                              // 当前登录时间
	CurrentSignInIP   string               `json:"current_sign_in_ip" gorm:"size:128"`              // 当前登录 IP
	LastSignInAt      timestamp.Timestamp  `json:"last_sign_in_at"`                                 // 上次登录时间
	LastSignInIP      string               `json:"last_sign_in_ip"    gorm:"size:128"`              // 上次登录 IP
	FailedAttempts    int                  `json:"failed_attempts"`                                 // 失败尝试次数
	UnlockToken       string               `json:"unlock_token"`                                    // 解锁 token
	LockedAt          *timestamp.Timestamp `json:"locked_at"`                                       // 锁定时间

	CreatedAt timestamp.Timestamp `json:"created_at"`
	UpdatedAt timestamp.Timestamp `json:"updated_at"`
}

User 用户

func (*User) RoomUserID

func (user *User) RoomUserID() string

RoomUserID return rtn user id

type UserToken

type UserToken struct {
	ID        uint   `json:"id" gorm:"primary_key"`
	UserID    uint   `json:"-"  gorm:"index"`
	IssureAt  int64  `json:"issure_at"`
	Expire    int64  `json:"expire"`
	IP        string `json:"-"`
	UserAgent string `json:"-"`
	Activity  int64  `json:"-"`
}

UserToken with use auth

func (UserToken) TableName

func (UserToken) TableName() string

TableName return table name

func (UserToken) Valid

func (token UserToken) Valid() (err error)

Valid JWT Claims interface method

Jump to

Keyboard shortcuts

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