post

package
v1.26.15 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID xid.ID

ID wraps the underlying xid type for all kinds of Storyden Post data type.

func (ID) MarshalJSON

func (u ID) MarshalJSON() ([]byte, error)

func (ID) String

func (u ID) String() string

func (*ID) UnmarshalJSON

func (u *ID) UnmarshalJSON(data []byte) error

type Post

type Post struct {
	ID   ID
	Root ID // Identical to ID if this is the root.

	Title       string
	Slug        string
	Content     datagraph.Content
	Author      profile.Ref
	Likes       like.Status
	Collections collection_item_status.Status
	Reacts      []*reaction.React
	Assets      []*asset.Asset
	WebLink     opt.Optional[link_ref.LinkRef]
	Meta        map[string]any
	Visibility  visibility.Visibility

	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt opt.Optional[time.Time]
	IndexedAt opt.Optional[time.Time]
}

func Map

func Map(in *ent.Post) (*Post, error)

func (*Post) GetAssets

func (p *Post) GetAssets() []*asset.Asset

func (*Post) GetContent

func (p *Post) GetContent() datagraph.Content

func (*Post) GetCreated

func (p *Post) GetCreated() time.Time

func (*Post) GetDesc

func (p *Post) GetDesc() string

func (*Post) GetID

func (p *Post) GetID() xid.ID

func (*Post) GetKind

func (p *Post) GetKind() datagraph.Kind

func (*Post) GetName

func (p *Post) GetName() string

func (*Post) GetProps

func (p *Post) GetProps() map[string]any

func (*Post) GetSlug

func (p *Post) GetSlug() string

func (*Post) GetUpdated

func (p *Post) GetUpdated() time.Time

type PostLikesMap

type PostLikesMap map[xid.ID]PostLikesResult

PostLikesMap maps the likes aggregation back to individual posts.

func (PostLikesMap) Status

func (p PostLikesMap) Status(id xid.ID) like.Status

type PostLikesResult

type PostLikesResult struct {
	PostID xid.ID `db:"post_id"`
	Count  int    `db:"likes"`
	Liked  int    `db:"liked"`
}

PostLikesResult is used for querying all members who liked posts in a thread.

func (PostLikesResult) Status

func (p PostLikesResult) Status() like.Status

type PostLikesResults

type PostLikesResults []PostLikesResult

func (PostLikesResults) Map

type PostRef

type PostRef struct {
	ID   ID
	Root ID
}

func MapRef

func MapRef(in *ent.Post) *PostRef

func (*PostRef) IsThread

func (p *PostRef) IsThread() bool

type PostRepliesMap

type PostRepliesMap map[xid.ID]PostRepliesResult

PostRepliesMap maps the likes aggregation back to individual posts.

func (PostRepliesMap) Status

func (p PostRepliesMap) Status(id xid.ID) ReplyStatus

type PostRepliesResult

type PostRepliesResult struct {
	PostID  xid.ID `db:"post_id"`
	Count   int    `db:"replies"`
	Replied int    `db:"replied"`
}

func (PostRepliesResult) Status

func (p PostRepliesResult) Status() ReplyStatus

type PostRepliesResults

type PostRepliesResults []PostRepliesResult

func (PostRepliesResults) Map

type ReadStateMap

type ReadStateMap map[xid.ID]ReadStateResult

ReadStateMap maps the likes aggregation back to individual posts.

func (ReadStateMap) Status

func (p ReadStateMap) Status(id xid.ID) opt.Optional[ReadStatus]

type ReadStateResult

type ReadStateResult struct {
	PostID     xid.ID `db:"post_id"`
	NewReplies int    `db:"new_replies"`
	LastReadAt string `db:"last_read_at"`
}

func (ReadStateResult) Status

func (p ReadStateResult) Status() ReadStatus

type ReadStateResults

type ReadStateResults []ReadStateResult

func (ReadStateResults) Map

type ReadStatus

type ReadStatus struct {
	Count      int
	LastReadAt time.Time
}

type ReplyStatus

type ReplyStatus struct {
	Count   int
	Replied int
}

Jump to

Keyboard shortcuts

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