models

package
v0.0.0-...-7493986 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDB

func GetDB() *gorm.DB

func InitDB

func InitDB(dbUrI string)

func ReturnListOfTables

func ReturnListOfTables() []interface{}

Types

type Base

type Base struct {
	ID        uint64
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

func (*Base) BeforeCreate

func (base *Base) BeforeCreate(scope *gorm.Scope) error

type Comment

type Comment struct {
	Base
	PostID  uint64
	UserID  uint64
	Comment string
}

type CommentReply

type CommentReply struct {
	Base
	CommentID uint64
	UserID    uint64
	Reply     string
}

type Like

type Like struct {
	Base
	ItemID   uint64
	UserID   uint64
	Category string
}

type Post

type Post struct {
	Base
	UserID      uint64
	Description string
	PostMedias  []PostMedia `gorm:"foreignKey:PostID"`
	Comments    []Comment   `gorm:"foreignKey:PostID"`
}

type PostMedia

type PostMedia struct {
	Base
	PostID    uint64
	MediaType string
	FileName  string
}

type User

type User struct {
	Base
	Username   string
	Email      string
	Phone      string
	Password   string
	ProfilePic string
	CoverPhoto string
	Posts      []Post    `gorm:"foreignKey:UserID"`
	Comments   []Comment `gorm:"foreignKey:UserID"`
}

Jump to

Keyboard shortcuts

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