gormt

package
v0.0.0-...-7604275 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DeviceAckColumns = struct {
	ID         string
	DeviceID   string
	Ack        string
	CreateTime string
	UpdateTime string
}{
	ID:         "id",
	DeviceID:   "device_id",
	Ack:        "ack",
	CreateTime: "create_time",
	UpdateTime: "update_time",
}

DeviceAckColumns get sql column name.获取数据库列名

View Source
var DeviceColumns = struct {
	ID            string
	DeviceID      string
	AppID         string
	UserID        string
	Type          string
	Brand         string
	Model         string
	SystemVersion string
	SdkVersion    string
	Status        string
	ConnAddr      string
	ConnFd        string
	CreateTime    string
	UpdateTime    string
}{
	ID:            "id",
	DeviceID:      "device_id",
	AppID:         "app_id",
	UserID:        "user_id",
	Type:          "type",
	Brand:         "brand",
	Model:         "model",
	SystemVersion: "system_version",
	SdkVersion:    "sdk_version",
	Status:        "status",
	ConnAddr:      "conn_addr",
	ConnFd:        "conn_fd",
	CreateTime:    "create_time",
	UpdateTime:    "update_time",
}

DeviceColumns get sql column name.获取数据库列名

View Source
var GidColumns = struct {
	ID          string
	BusinessID  string
	MaxID       string
	Step        string
	Description string
	CreateTime  string
	UpdateTime  string
}{
	ID:          "id",
	BusinessID:  "business_id",
	MaxID:       "max_id",
	Step:        "step",
	Description: "description",
	CreateTime:  "create_time",
	UpdateTime:  "update_time",
}

GidColumns get sql column name.获取数据库列名

View Source
var GroupColumns = struct {
	ID           string
	Name         string
	Introduction string
	Extra        string
	UserID       string
	CreatedAt    string
	UpdatedAt    string
	DeletedAt    string
}{
	ID:           "id",
	Name:         "name",
	Introduction: "introduction",
	Extra:        "extra",
	UserID:       "user_id",
	CreatedAt:    "created_at",
	UpdatedAt:    "updated_at",
	DeletedAt:    "deleted_at",
}

GroupColumns get sql column name.获取数据库列名

View Source
var GroupUserColumns = struct {
	ID           string
	GroupID      string
	UserID       string
	UserShowName string
	Extra        string
	CreatedAt    string
	UpdatedAt    string
	DeletedAt    string
}{
	ID:           "id",
	GroupID:      "group_id",
	UserID:       "user_id",
	UserShowName: "user_show_name",
	Extra:        "extra",
	CreatedAt:    "created_at",
	UpdatedAt:    "updated_at",
	DeletedAt:    "deleted_at",
}

GroupUserColumns get sql column name.获取数据库列名

View Source
var MessageColumns = struct {
	ID           string
	SenderID     string
	SenderType   string
	ReceiverID   string
	ReceiverType string
	AtUserID     string
	MessageType  string
	Status       string
	CreatedAt    string
	UpdatedAt    string
	DeletedAt    string
}{
	ID:           "id",
	SenderID:     "sender_id",
	SenderType:   "sender_type",
	ReceiverID:   "receiver_id",
	ReceiverType: "receiver_type",
	AtUserID:     "at_user_id",
	MessageType:  "message_type",
	Status:       "status",
	CreatedAt:    "created_at",
	UpdatedAt:    "updated_at",
	DeletedAt:    "deleted_at",
}

MessageColumns get sql column name.获取数据库列名

View Source
var UserColumns = struct {
	ID        string
	Nickname  string
	Password  string
	Gender    string
	AvatarURL string
	Extra     string
	CreatedAt string
	UpdatedAt string
	DeletedAt string
}{
	ID:        "id",
	Nickname:  "nickname",
	Password:  "password",
	Gender:    "gender",
	AvatarURL: "avatar_url",
	Extra:     "extra",
	CreatedAt: "created_at",
	UpdatedAt: "updated_at",
	DeletedAt: "deleted_at",
}

UserColumns get sql column name.获取数据库列名

Functions

func CloseRelated

func CloseRelated()

CloseRelated 关闭全局预加载

func DeviceAckMgr

func DeviceAckMgr(db *gorm.DB) *_DeviceAckMgr

DeviceAckMgr open func

func DeviceMgr

func DeviceMgr(db *gorm.DB) *_DeviceMgr

DeviceMgr open func

func GidMgr

func GidMgr(db *gorm.DB) *_GidMgr

GidMgr open func

func GroupMgr

func GroupMgr(db *gorm.DB) *_GroupMgr

GroupMgr open func

func GroupUserMgr

func GroupUserMgr(db *gorm.DB) *_GroupUserMgr

GroupUserMgr open func

func MessageMgr

func MessageMgr(db *gorm.DB) *_MessageMgr

MessageMgr open func

func OpenRelated

func OpenRelated()

OpenRelated 打开全局预加载

func UserMgr

func UserMgr(db *gorm.DB) *_UserMgr

UserMgr open func

Types

type Condition

type Condition struct {
	// contains filtered or unexported fields
}

自定义sql查询

func (*Condition) And

func (c *Condition) And(column string, cases string, value interface{})

And a condition by and .and 一个条件

func (*Condition) Get

func (c *Condition) Get() (where string, out []interface{})

func (*Condition) Or

func (c *Condition) Or(column string, cases string, value interface{})

Or a condition by or .or 一个条件

type Device

type Device struct {
	ID            uint64    `gorm:"primaryKey;column:id;type:bigint unsigned;not null" json:"id"`                                  // 自增主键
	DeviceID      int64     `gorm:"unique;column:device_id;type:bigint;not null" json:"deviceId"`                                  // 设备id
	AppID         uint64    `gorm:"index:idx_app_id_user_id;column:app_id;type:bigint unsigned;not null" json:"appId"`             // app_id
	UserID        uint64    `gorm:"index:idx_app_id_user_id;column:user_id;type:bigint unsigned;not null;default:0" json:"userId"` // 账户id
	Type          int8      `gorm:"column:type;type:tinyint;not null" json:"type"`                                                 // 设备类型,1:Android;2:IOS;3:Windows; 4:MacOS;5:Web
	Brand         string    `gorm:"column:brand;type:varchar(20);not null" json:"brand"`                                           // 手机厂商
	Model         string    `gorm:"column:model;type:varchar(20);not null" json:"model"`                                           // 机型
	SystemVersion string    `gorm:"column:system_version;type:varchar(10);not null" json:"systemVersion"`                          // 系统版本
	SdkVersion    string    `gorm:"column:sdk_version;type:varchar(10);not null" json:"sdkVersion"`                                // app版本
	Status        int8      `gorm:"column:status;type:tinyint;not null;default:0" json:"status"`                                   // 在线状态,0:离线;1:在线
	ConnAddr      string    `gorm:"column:conn_addr;type:varchar(25);not null" json:"connAddr"`                                    // 连接层服务器地址
	ConnFd        int64     `gorm:"column:conn_fd;type:bigint;not null" json:"connFd"`                                             // TCP连接对应的文件描述符
	CreateTime    time.Time `gorm:"column:create_time;type:datetime;not null;default:CURRENT_TIMESTAMP" json:"createTime"`         // 创建时间
	UpdateTime    time.Time `gorm:"column:update_time;type:datetime;not null;default:CURRENT_TIMESTAMP" json:"updateTime"`         // 更新时间
}

Device 设备

type DeviceAck

type DeviceAck struct {
	ID         uint64    `gorm:"primaryKey;column:id;type:bigint unsigned;not null" json:"id"`                          // 自增主键
	DeviceID   uint64    `gorm:"unique;column:device_id;type:bigint unsigned;not null" json:"deviceId"`                 // 设备id
	Ack        uint64    `gorm:"column:ack;type:bigint unsigned;not null;default:0" json:"ack"`                         // 收到消息确认号
	CreateTime time.Time `gorm:"column:create_time;type:datetime;not null;default:CURRENT_TIMESTAMP" json:"createTime"` // 创建时间
	UpdateTime time.Time `gorm:"column:update_time;type:datetime;not null;default:CURRENT_TIMESTAMP" json:"updateTime"` // 更新时间
}

DeviceAck 设备消息同步序列号

type Gid

type Gid struct {
	ID          uint64    `gorm:"primaryKey;column:id;type:bigint unsigned;not null" json:"id"`                          // 自增主键
	BusinessID  string    `gorm:"unique;column:business_id;type:varchar(128);not null" json:"businessId"`                // 业务id
	MaxID       uint64    `gorm:"column:max_id;type:bigint unsigned;not null;default:0" json:"maxId"`                    // 最大id
	Step        uint      `gorm:"column:step;type:int unsigned;not null;default:1000" json:"step"`                       // 步长
	Description string    `gorm:"column:description;type:varchar(255);not null" json:"description"`                      // 描述
	CreateTime  time.Time `gorm:"column:create_time;type:datetime;not null;default:CURRENT_TIMESTAMP" json:"createTime"` // 创建时间
	UpdateTime  time.Time `gorm:"column:update_time;type:datetime;not null;default:CURRENT_TIMESTAMP" json:"updateTime"` // 更新时间
}

Gid 分布式自增主键

type Group

type Group struct {
	ID           uint64    `gorm:"primaryKey;column:id;type:bigint unsigned;not null" json:"id"`                  // 自增主键
	Name         string    `gorm:"column:name;type:varchar(50);not null;default:''" json:"name"`                  // 群组名称
	Introduction string    `gorm:"column:introduction;type:varchar(255);not null;default:''" json:"introduction"` // 群组简介
	Extra        string    `gorm:"column:extra;type:varchar(1024);not null;default:''" json:"extra"`              // 附加属性
	UserID       int64     `gorm:"column:user_id;type:bigint;not null;default:0" json:"userId"`                   // 群主ID
	CreatedAt    time.Time `gorm:"column:created_at;type:datetime" json:"createdAt"`                              // 创建时间
	UpdatedAt    time.Time `gorm:"column:updated_at;type:datetime" json:"updatedAt"`                              // 更新时间
	DeletedAt    time.Time `gorm:"column:deleted_at;type:datetime" json:"deletedAt"`                              // 删除时间
}

Group 群组

type GroupUser

type GroupUser struct {
	ID           uint64    `gorm:"primaryKey;column:id;type:bigint unsigned;not null" json:"id"`                                                 // 自增主键
	GroupID      uint64    `gorm:"uniqueIndex:uk_group_id_user_id;column:group_id;type:bigint unsigned;not null" json:"groupId"`                 // 组id
	UserID       uint64    `gorm:"uniqueIndex:uk_group_id_user_id;index:idx_user_id;column:user_id;type:bigint unsigned;not null" json:"userId"` // 用户id
	UserShowName string    `gorm:"column:user_show_name;type:varchar(20);not null" json:"userShowName"`                                          // 用户在群组的昵称
	Extra        string    `gorm:"column:extra;type:varchar(1024);not null" json:"extra"`                                                        // 附加属性
	CreatedAt    time.Time `gorm:"column:created_at;type:datetime" json:"createdAt"`                                                             // 创建时间
	UpdatedAt    time.Time `gorm:"column:updated_at;type:datetime" json:"updatedAt"`                                                             // 更新时间
	DeletedAt    time.Time `gorm:"index:deleted_at;column:deleted_at;type:datetime" json:"deletedAt"`                                            // 删除时间
}

GroupUser 群组成员关系

type Message

type Message struct {
	ID           uint64    `gorm:"primaryKey;column:id;type:bigint unsigned;not null" json:"id"`
	SenderID     uint64    `gorm:"column:sender_id;type:bigint unsigned;not null;default:0" json:"senderId"`     // 发送人ID
	SenderType   int8      `gorm:"column:sender_type;type:tinyint;not null;default:0" json:"senderType"`         // 发送人类型
	ReceiverID   uint64    `gorm:"column:receiver_id;type:bigint unsigned;not null;default:0" json:"receiverId"` // 接收人ID,单聊则为user_id,群聊则为group_id
	ReceiverType int8      `gorm:"column:receiver_type;type:tinyint;not null;default:0" json:"receiverType"`     // 接收人类型
	AtUserID     string    `gorm:"column:at_user_id;type:varchar(255);not null;default:''" json:"atUserId"`      // 需要@的用户,多个用,分割
	MessageType  int       `gorm:"column:message_type;type:int;not null;default:0" json:"messageType"`           // 消息类型
	Status       int8      `gorm:"column:status;type:tinyint;not null;default:1" json:"status"`                  // 状态:1-正常,2-撤回,0-删除
	CreatedAt    time.Time `gorm:"column:created_at;type:datetime" json:"createdAt"`                             // 创建时间
	UpdatedAt    time.Time `gorm:"column:updated_at;type:datetime" json:"updatedAt"`                             // 更新时间
	DeletedAt    time.Time `gorm:"column:deleted_at;type:datetime" json:"deletedAt"`                             // 删除时间
}

Message 消息

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option overrides behavior of Connect.

type User

type User struct {
	ID        uint64    `gorm:"primaryKey;column:id;type:bigint unsigned;not null" json:"id"`              // 自增主键
	Nickname  string    `gorm:"column:nickname;type:varchar(20);not null;default:''" json:"nickname"`      // 昵称
	Password  string    `gorm:"column:password;type:varchar(100);not null;default:''" json:"password"`     // 密码
	Gender    string    `gorm:"column:gender;type:enum('1','2');not null" json:"gender"`                   // 性别,0:未知;1:男;2:女
	AvatarURL string    `gorm:"column:avatar_url;type:varchar(1024);not null;default:''" json:"avatarUrl"` // 用户头像链接
	Extra     string    `gorm:"column:extra;type:varchar(1024);not null;default:''" json:"extra"`          // 附加属性
	CreatedAt time.Time `gorm:"column:created_at;type:datetime" json:"createdAt"`                          // 创建时间
	UpdatedAt time.Time `gorm:"column:updated_at;type:datetime" json:"updatedAt"`                          // 更新时间
	DeletedAt time.Time `gorm:"index:deleted_at;column:deleted_at;type:datetime" json:"deletedAt"`         // 删除时间
}

User 用户

Jump to

Keyboard shortcuts

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