models

package
v0.0.0-...-3eb3fbd Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: GPL-3.0 Imports: 2 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chat

type Chat struct {
	ID           uint64         `gorm:"primaryKey" json:"id"`
	Messages     []Message      `json:"messages"`
	Participants []*User        `gorm:"many2many:participants;" json:"participants"`
	CreatedAt    time.Time      `json:"createdAt"`
	UpdatedAt    time.Time      `json:"updatedAt"`
	DeletedAt    gorm.DeletedAt `json:"deletedAt"`
}

type Comment

type Comment struct {
	ID        uint64         `gorm:"primaryKey" json:"id"`
	Content   string         `json:"content"`
	UserID    uint64         `gorm:"not null" json:"userId"`
	PostID    uint64         `gorm:"not null" json:"postId"`
	CreatedAt time.Time      `json:"createdAt"`
	UpdatedAt time.Time      `json:"updatedAt"`
	DeletedAt gorm.DeletedAt `json:"deletedAt"`
}

func (*Comment) ToReadCommentDTO

func (c *Comment) ToReadCommentDTO() ReadCommentDTO

type Message

type Message struct {
	ID        uint64         `gorm:"primaryKey" json:"id"`
	Content   string         `json:"content"`
	UserID    uint64         `gorm:"not null" json:"userId"`
	ChatID    uint64         `gorm:"not null" json:"chatId"`
	CreatedAt time.Time      `json:"createdAt"`
	UpdatedAt time.Time      `json:"updatedAt"`
	DeletedAt gorm.DeletedAt `json:"deletedAt"`
}

func (*Message) ToReadMessageDTO

func (m *Message) ToReadMessageDTO() ReadMessageDTO

type Post

type Post struct {
	ID        uint64         `gorm:"primaryKey" json:"id"`
	Title     string         `json:"title"`
	Content   string         `json:"content"`
	Comments  []Comment      `json:"comments"`
	UserID    uint64         `gorm:"not null; index" json:"userId"`
	CreatedAt time.Time      `json:"createdAt"`
	UpdatedAt time.Time      `json:"updatedAt"`
	DeletedAt gorm.DeletedAt `json:"deletedAt"`
}

func (*Post) ToReadPostDTO

func (p *Post) ToReadPostDTO() ReadPostDTO

type ReadCommentDTO

type ReadCommentDTO struct {
	ID        uint64 `json:"id"`
	Content   string `json:"content"`
	UserID    uint64 `json:"userId"`
	PostID    uint64 `json:"postId"`
	CreatedAt string `json:"createdAt"`
	UpdatedAt string `json:"updatedAt"`
}

type ReadMessageDTO

type ReadMessageDTO struct {
	ID        uint64 `json:"id"`
	Content   string `json:"content"`
	UserID    uint64 `json:"userId"`
	ChatID    uint64 `json:"chatId"`
	CreatedAt string `json:"createdAt"`
	UpdatedAt string `json:"updatedAt"`
}

type ReadPostDTO

type ReadPostDTO struct {
	ID        uint64 `json:"id"`
	Title     string `json:"title"`
	Content   string `json:"content"`
	UserID    uint64 `json:"userId"`
	CreatedAt string `json:"createdAt"`
	UpdatedAt string `json:"updatedAt"`
}

type ReadUserDTO

type ReadUserDTO struct {
	ID        uint64 `json:"id"`
	Name      string `json:"name"`
	Email     string `json:"email"`
	CreatedAt string `json:"createdAt"`
	UpdatedAt string `json:"updatedAt"`
}

type RedisRecord

type RedisRecord struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type User

type User struct {
	ID        uint64         `gorm:"primaryKey" json:"id"`
	Name      string         `json:"name"`
	Email     string         `gorm:"unique;not null;index" json:"email"`
	Posts     []Post         `json:"posts"`
	Messages  []Message      `json:"messages"`
	Comments  []Comment      `json:"comments"`
	Chats     []*Chat        `gorm:"many2many:participants;" json:"chats"`
	CreatedAt time.Time      `json:"createdAt"`
	UpdatedAt time.Time      `json:"updatedAt"`
	DeletedAt gorm.DeletedAt `json:"deletedAt"`
}

func (*User) ToReadUserDTO

func (u *User) ToReadUserDTO() ReadUserDTO

type WriteCommentDTO

type WriteCommentDTO struct {
	Content string `json:"content"`
	UserID  uint64 `json:"userId"`
	PostID  uint64 `json:"postId"`
}

func (*WriteCommentDTO) ToComment

func (c *WriteCommentDTO) ToComment() Comment

type WriteMessageDTO

type WriteMessageDTO struct {
	Content string `json:"content"`
	UserID  uint64 `json:"userId"`
	ChatID  uint64 `json:"chatId"`
}

func (*WriteMessageDTO) ToMessage

func (m *WriteMessageDTO) ToMessage() Message

type WritePostDTO

type WritePostDTO struct {
	Title   string `json:"title"`
	Content string `json:"content"`
	UserID  uint64 `json:"userId"`
}

func (*WritePostDTO) ToPost

func (p *WritePostDTO) ToPost() Post

type WriteUserDTO

type WriteUserDTO struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

func (*WriteUserDTO) ToUser

func (u *WriteUserDTO) ToUser() User

Jump to

Keyboard shortcuts

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