service

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataStore

type DataStore struct {
	engine.Interface
	EditDuration   time.Duration
	Secret         string
	MaxCommentSize int
	// contains filtered or unexported fields
}

DataStore wraps store.Interface with additional methods

func (*DataStore) Counts

func (s *DataStore) Counts(siteID string, postIDs []string) ([]store.PostInfo, error)

Counts returns postID+count list for given comments

func (*DataStore) Create

func (s *DataStore) Create(comment store.Comment) (commentID string, err error)

Create prepares comment and forward to Interface.Create

func (*DataStore) EditComment

func (s *DataStore) EditComment(locator store.Locator, commentID string, req EditRequest) (comment store.Comment, err error)

EditComment to edit text and update Edit info

func (*DataStore) IsVerifiedFn

func (s *DataStore) IsVerifiedFn() func(siteID string, userID string) bool

IsVerifiedFn returns func to check if user verified or not

func (*DataStore) SetPin

func (s *DataStore) SetPin(locator store.Locator, commentID string, status bool) error

SetPin pin/un-pin comment as special

func (*DataStore) ValidateComment

func (s *DataStore) ValidateComment(c *store.Comment) error

ValidateComment checks if comment size below max and user fields set

func (*DataStore) Vote

func (s *DataStore) Vote(locator store.Locator, commentID string, userID string, val bool) (comment store.Comment, err error)

Vote for comment by id and locator

type EditRequest

type EditRequest struct {
	Text    string
	Orig    string
	Summary string
}

EditRequest contains fields needed for comment update

Jump to

Keyboard shortcuts

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