services

package
v0.0.0-...-c9b56a8 Latest Latest
Warning

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

Go to latest
Published: May 9, 2021 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateThreadReq

type CreateThreadReq struct {
	NodeID     base.ID
	ReplyForID base.ID
	Title      string
	Abstract   string
	Content    string
}

type CreateThreadRes

type CreateThreadRes struct {
	Thread Thread
}

type GetNodeReq

type GetNodeReq struct {
	// 0 for list all top level-nodes
	ID base.ID
}

type GetNodeRes

type GetNodeRes struct {
	Node     *models.Node
	Children []models.Node
}

type GetThreadReq

type GetThreadReq struct {
	NodeID base.ID

	ID base.ID
}

type GetThreadRes

type GetThreadRes struct {
	Thread Thread
}

type ListThreadsReq

type ListThreadsReq struct {
	NodeID base.ID

	// 0 for list all non-reply threads
	ID base.ID

	// `UpdatedBefore` & `Limit` are used for pagination
	UpdatedBefore null.Time
	Limit         int
}

type ListThreadsRes

type ListThreadsRes struct {
	Threads []Thread
}

type NodeService

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

func NewNodeService

func NewNodeService(db *gorm.DB) *NodeService

func (*NodeService) GetNode

func (s *NodeService) GetNode(ctx *rpc.Context, req *GetNodeReq, res *GetNodeRes) (err error)

type Thread

type Thread struct {
	ID         base.ID
	UserID     base.ID
	NodeID     base.ID
	ReplyForID base.ID
	//HotReplyUserID   int64
	//HotReplyAbstract string
	RepliesCount int64
	Title        string
	Abstract     string
	Content      string
	ImagesURL    string
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

type ThreadService

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

func NewThreadService

func NewThreadService(db *gorm.DB) *ThreadService

func (*ThreadService) CreateThread

func (s *ThreadService) CreateThread(ctx *rpc.Context, req *CreateThreadReq, res *CreateThreadRes) (err error)

func (*ThreadService) GetThread

func (s *ThreadService) GetThread(ctx *rpc.Context, req *GetThreadReq, res *GetThreadRes) (err error)

func (*ThreadService) ListThreads

func (s *ThreadService) ListThreads(ctx *rpc.Context, req *ListThreadsReq, res *ListThreadsRes) (err error)

Jump to

Keyboard shortcuts

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