database

package
v0.0.0-...-e7f8777 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDB

func InitDB(driver string, dsn string) (db *gorm.DB, err error)

func InitRedis

func InitRedis(addr, pass string) (*redis.Client, error)

func KeyMessageAckIndex

func KeyMessageAckIndex(account string) string

Types

type Group

type Group struct {
	Model
	Group       string `gorm:"size:30;not null;unique_index"`
	App         string `gorm:"size:30;not null"`
	Name        string `gorm:"size:50;not null"`
	Owner       string `gorm:"size:60;not null"`
	Avatar      string `gorm:"size:200;not null"`
	Introdution string `gorm:"size:300;not null"`
}

type GroupMember

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

type IDGenerator

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

func NewIDGenerator

func NewIDGenerator(nodeID int64) (*IDGenerator, error)

func (*IDGenerator) Next

func (g *IDGenerator) Next() snowflake.ID

func (*IDGenerator) Parse

func (g *IDGenerator) Parse(id int64) snowflake.ID

func (*IDGenerator) ParseBase36

func (g *IDGenerator) ParseBase36(id string) (snowflake.ID, error)

type MessageContent

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

type MessageIndex

type MessageIndex struct {
	ID        int64  `gorm:"primary_key;auto_increment;not null"`
	AccountA  string `gorm:"size:60;not null;index"`
	AccountB  string `gorm:"size:60;not null;comment:'The other party account'"`
	Direction byte   `gorm:"not null;default:0;comment:'0:A is the sender,1:A is the receiver'"`
	MessageID int64  `gorm:"not null"`
	Group     string `gorm:"size:30;not null;comment:'Group ID'"`
	SendTime  int64  `gorm:"not null;index"`
}

type Model

type Model struct {
	ID        int64     `gorm:"primary_key;auto_increment;not null"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type User

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

Jump to

Keyboard shortcuts

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