articleLike

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveOrCreateById

func SaveOrCreateById(entity *Entity) int64

Types

type Entity

type Entity struct {
	Id        uint64    `gorm:"primaryKey;column:id;autoIncrement;not null;" json:"id"`                                                              // 主键
	UserId    uint64    `gorm:"column:user_id;type:bigint unsigned;not null;default:0;uniqueIndex:uniq_user_article,priority:1" json:"userId"`       // 用户
	ArticleId uint64    `gorm:"column:article_id;type:bigint unsigned;not null;default:0;uniqueIndex:uniq_user_article,priority:2" json:"articleId"` //
	Status    int       `gorm:"column:status;type:int;not null;default:1;" json:"status"`                                                            // 点赞状态(1:有效点赞 0:取消点赞)
	CreatedAt time.Time `gorm:"column:created_at;autoCreateTime;" json:"createdAt"`                                                                  //
	UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime;index;" json:"updatedAt"`
}

func Get

func Get(id any) (entity Entity)

func GetByArticleId

func GetByArticleId(userId, articleId any) (entity Entity)

func (*Entity) TableName

func (itself *Entity) TableName() string

Jump to

Keyboard shortcuts

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