database

package
v0.0.0-...-93c743e Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitMysqlDb

func InitMysqlDb(dsn string) (*gorm.DB, error)

Types

type Group

type Group struct {
	Model
	Group        string `gorm:"uniqueIndex;size:30"`
	App          string `gorm:"size:30"`
	Name         string `gorm:"size:50"`
	Owner        string `gorm:"size:60"`
	Avatar       string `gorm:"size:200"`
	Introduction string `gorm:"size:300"`
}

type GroupMember

type GroupMember struct {
	Model
	Account string `gorm:"uniqueIndex:uni_gp_acc;size:60"`
	Group   string `gorm:"uniqueIndex:uni_gp_acc;index;size:30"`
	Alias   string `gorm:"size:30"`
}

GroupMember GroupMember

type MessageContent

type MessageContent struct {
	ID       int64  `gorm:"primarykey"`
	Type     byte   `gorm:"default:0"`
	Body     string `gorm:"size:5000;not null"`
	Extra    string `gorm:"size:500"`
	SendTime int64  `gorm:"index"`
}

type MessageIndex

type MessageIndex struct {
	ID        int64  `gorm:"primarykey"`
	AccountA  string `gorm:"index;size:60;not null;comment:队列唯一标识"`
	AccountB  string `gorm:"size:60;not null;comment:另一方"`
	Direction byte   `gorm:"default:0;not null;comment:1表示AccountA为发送者"`
	MessageID int64  `gorm:"not null;comment:关联消息内容表中的ID"`
	Group     string `gorm:"size:30;comment:群ID,单聊情况为空"`
	SendTime  int64  `gorm:"index;not null;comment:消息发送时间"`
}

type Model

type Model struct {
	ID        int64 `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

type User

type User struct {
	Model
	App      string `gorm:"size:30"`
	Account  string `gorm:"uniqueIndex;size:60"`
	Password string `gorm:"size:30"`
	Avatar   string `gorm:"size:200"`
	Nickname string `gorm:"size:20"`
}

Jump to

Keyboard shortcuts

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