share

package
v0.0.0-...-b8189d2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShareNoteCollection        = "share_notes"
	ShareNoteCommentCollection = "share_note_comments"
)
View Source
const (
	IDField          = "_id"
	ShareNoteIDField = "share_note_id"
)

Variables

View Source
var ShareNoteShareTypeMap = map[ShareNoteShareType]string{
	ShareTypeDefault:    "default",
	ShareTypeCanView:    "can_view",
	ShareTypeCanComment: "can_comment",
	ShareTypeCanEdit:    "can_edit",
}
View Source
var ShareNoteShareTypeReverseMap = map[string]ShareNoteShareType{
	"default":     ShareTypeDefault,
	"can_view":    ShareTypeCanView,
	"can_comment": ShareTypeCanComment,
	"can_edit":    ShareTypeCanEdit,
}
View Source
var ShareNoteStatusMap = map[ShareNoteStatus]string{
	ShareNoteStatusDefault: "default",
	ShareNoteStatusExpired: "expired",
	ShareNoteStatusCancel:  "cancel",
}
View Source
var ShareNoteStatusReverseMap = map[string]ShareNoteStatus{
	"default": ShareNoteStatusDefault,
	"expired": ShareNoteStatusExpired,
	"cancel":  ShareNoteStatusCancel,
}

Functions

func InsertShareNote

func InsertShareNote(ctx *biz_context.BizContext, shareNote *ShareNote) error

func InsertShareNoteComment

func InsertShareNoteComment(ctx *biz_context.BizContext, comment *ShareNoteComment) error

func UpdateShareNote

func UpdateShareNote(ctx *biz_context.BizContext, shareNote *ShareNote) error

Types

type ShareNote

type ShareNote struct {
	ID        string             `bson:"_id"`
	NoteID    string             `bson:"note_id"`
	UserID    string             `bson:"user_id"`
	NoteType  string             `bson:"note_type"`
	NoteTitle string             `bson:"note_title"`
	UserName  string             `bson:"username"`
	ShareType ShareNoteShareType `bson:"share_type"`
	ShareURL  string             `bson:"share_url"`
	ViewCount int                `bson:"view_count"`
	Status    ShareNoteStatus    `bson:"status"`
	CreatedAt time.Time          `bson:"created_at"`
	UpdatedAt time.Time          `bson:"updated_at"`
}

func GetShareNote

func GetShareNote(ctx *biz_context.BizContext, shareID string) (*ShareNote, error)

type ShareNoteComment

type ShareNoteComment struct {
	ID          string    `bson:"_id"`
	ShareNoteID string    `bson:"share_note_id"`
	Alias       string    `bson:"alias"`
	Content     string    `bson:"content"`
	IP          string    `bson:"ip"`
	CreatedAt   time.Time `bson:"created_at"`
}

func GetShareNoteCommentsWithShareNoteID

func GetShareNoteCommentsWithShareNoteID(ctx *biz_context.BizContext, shareNoteID string, page int, pageSize int) ([]*ShareNoteComment, error)

type ShareNoteShareType

type ShareNoteShareType int
const (
	ShareTypeDefault ShareNoteShareType = iota
	ShareTypeCanView
	ShareTypeCanComment
	ShareTypeCanEdit
)

type ShareNoteStatus

type ShareNoteStatus int
const (
	ShareNoteStatusDefault ShareNoteStatus = iota
	ShareNoteStatusExpired
	ShareNoteStatusCancel
)

Jump to

Keyboard shortcuts

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