db

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB *gorm.DB
	SF *utils.Snowflake
)

Functions

func Convert

func Convert(message *Message, tempMessage *MiddleMessage) (err error)

func Init

func Init()

Types

type DBAction

type DBAction struct {
	DB *gorm.DB
}

func NewDBAction

func NewDBAction() *DBAction

func (*DBAction) InsertMessage

func (d *DBAction) InsertMessage(message *Message) error

type Message

type Message struct {
	Id         int64
	ToUserId   int64
	FromUserId int64
	Content    string
	CreatedAt  time.Time
	UpdatedAt  time.Time
	DeletedAt  gorm.DeletedAt `gorm:"index"`
}

func GetMessageList

func GetMessageList(ctx context.Context, to_user_id int64, from_user_id int64) ([]*Message, error)

type MessageArray

type MessageArray []*Message

func (MessageArray) Len

func (array MessageArray) Len() int

func (MessageArray) Less

func (array MessageArray) Less(i, j int) bool

func (MessageArray) Swap

func (array MessageArray) Swap(i, j int)

type MessageBuild

type MessageBuild struct {
	MessageElem *Message
	MessageList []*chat.Message
}

type MiddleMessage

type MiddleMessage struct {
	Id         int64
	ToUserId   int64
	FromUserId int64
	Content    string
	IsReadNum  []int64
	CreatedAt  string
}

Jump to

Keyboard shortcuts

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