articleLike

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetArticleLikeByArticleId added in v0.0.7

func GetArticleLikeByArticleId(articleId uint64) int64

func GetLikeGivenCount added in v0.0.3

func GetLikeGivenCount(userId uint64) int64

func GetLikeReceivedCount added in v0.0.3

func GetLikeReceivedCount(userId uint64) int64

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;<-:create;" 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