comm

package
v0.0.0-...-2799c83 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AlreadyPinned = 1
	NotPinned     = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	Id       uint64 `json:"id" db:"id"`
	Oid      uint64 `json:"oid" db:"oid"`
	CType    int8   `json:"ctype" db:"ctype"`
	Content  string `json:"content" db:"content"`
	Uid      uint64 `json:"uid" db:"uid"`
	RootId   uint64 `json:"root" db:"root"`
	ParentId uint64 `json:"parent" db:"parent"`
	ReplyUid uint64 `json:"ruid" db:"ruid"`
	State    int8   `json:"state" db:"state"`
	Like     int    `json:"like" db:"like"`
	Dislike  int    `json:"dislike" db:"dislike"`
	Report   int    `json:"repot" db:"report"`
	IsPin    int8   `json:"pin" db:"pin"`
	Ip       int64  `json:"ip" db:"ip"`
	Ctime    int64  `json:"ctime" db:"ctime"`
	Mtime    int64  `json:"mtime" db:"mtime"`
}

comment表

type Repo

type Repo struct {
	// contains filtered or unexported fields
}

func New

func New(db sqlx.SqlConn) *Repo

func (*Repo) AddDisLike

func (r *Repo) AddDisLike(ctx context.Context, id uint64) error

func (*Repo) AddDisLikeTx

func (r *Repo) AddDisLikeTx(ctx context.Context, tx sqlx.Session, id uint64) error

func (*Repo) AddLike

func (r *Repo) AddLike(ctx context.Context, id uint64) error

func (*Repo) AddLikeTx

func (r *Repo) AddLikeTx(ctx context.Context, tx sqlx.Session, id uint64) error

func (*Repo) AddReport

func (r *Repo) AddReport(ctx context.Context, id uint64) error

func (*Repo) AddReportTx

func (r *Repo) AddReportTx(ctx context.Context, tx sqlx.Session, id uint64) error

func (*Repo) CountByOid

func (r *Repo) CountByOid(ctx context.Context, oid uint64) (uint64, error)

查出oid评论总量

func (*Repo) CountGroupByOid

func (r *Repo) CountGroupByOid(ctx context.Context) (map[uint64]uint64, error)

func (*Repo) CountGroupByOidLimit

func (r *Repo) CountGroupByOidLimit(ctx context.Context, offset, limit int64) (map[uint64]uint64, error)

func (*Repo) DeleteById

func (r *Repo) DeleteById(ctx context.Context, id uint64) error

func (*Repo) DeleteByIdTx

func (r *Repo) DeleteByIdTx(ctx context.Context, tx sqlx.Session, id uint64) error

func (*Repo) DeleteByRootTx

func (r *Repo) DeleteByRootTx(ctx context.Context, tx sqlx.Session, rootId uint64) error

func (*Repo) DoPin

func (r *Repo) DoPin(ctx context.Context, oid, rid uint64) error

置顶

func (*Repo) FindById

func (r *Repo) FindById(ctx context.Context, id uint64) (*Model, error)

func (*Repo) FindByIdForUpdate

func (r *Repo) FindByIdForUpdate(ctx context.Context, tx sqlx.Session, id uint64) (*Model, error)

func (*Repo) FindByOid

func (r *Repo) FindByOid(ctx context.Context, oid uint64) ([]*Model, error)

func (*Repo) FindByOidTx

func (r *Repo) FindByOidTx(ctx context.Context, tx sqlx.Session, oid uint64, lock bool) ([]*Model, error)

func (*Repo) FindByParentIdTx

func (r *Repo) FindByParentIdTx(ctx context.Context, tx sqlx.Session, rootId uint64, lock bool) ([]*Model, error)

func (*Repo) FindByRootId

func (r *Repo) FindByRootId(ctx context.Context, rootId uint64) ([]*Model, error)

func (*Repo) FindRootParent

func (r *Repo) FindRootParent(ctx context.Context, id uint64) (*RootParent, error)

func (*Repo) GetPinned

func (r *Repo) GetPinned(ctx context.Context, oid uint64) (*Model, error)

func (*Repo) GetRootReplies

func (r *Repo) GetRootReplies(ctx context.Context, oid, cursor uint64, want int) ([]*Model, error)

获取主评论

func (*Repo) GetSubReply

func (r *Repo) GetSubReply(ctx context.Context, oid, root, cursor uint64, want int) ([]*Model, error)

获取子评论

func (*Repo) Insert

func (r *Repo) Insert(ctx context.Context, model *Model) (uint64, error)

func (*Repo) InsertTx

func (r *Repo) InsertTx(ctx context.Context, tx sqlx.Session, model *Model) (uint64, error)

func (*Repo) SetPin

func (r *Repo) SetPin(ctx context.Context, id uint64) error

func (*Repo) SetPinTx

func (r *Repo) SetPinTx(ctx context.Context, tx sqlx.Session, id uint64) error

func (*Repo) SetUnPin

func (r *Repo) SetUnPin(ctx context.Context, id uint64) error

func (*Repo) SetUnPinTx

func (r *Repo) SetUnPinTx(ctx context.Context, tx sqlx.Session, id uint64) error

func (*Repo) SubDisLike

func (r *Repo) SubDisLike(ctx context.Context, id uint64) error

func (*Repo) SubDisLikeTx

func (r *Repo) SubDisLikeTx(ctx context.Context, tx sqlx.Session, id uint64) error

func (*Repo) SubLike

func (r *Repo) SubLike(ctx context.Context, id uint64) error

func (*Repo) SubLikeTx

func (r *Repo) SubLikeTx(ctx context.Context, tx sqlx.Session, id uint64) error

func (*Repo) SubReport

func (r *Repo) SubReport(ctx context.Context, id uint64) error

func (*Repo) SubReportTx

func (r *Repo) SubReportTx(ctx context.Context, tx sqlx.Session, id uint64) error

type RootParent

type RootParent struct {
	Id       uint64 `json:"id" db:"id"`
	RootId   uint64 `json:"root" db:"root"`
	ParentId uint64 `json:"parent" db:"parent"`
	Oid      uint64 `json:"oid" db:"oid"`
	IsPin    int8   `json:"is_pin" db:"pin"`
}

Jump to

Keyboard shortcuts

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