comment

package
v0.0.0-...-dd01cb3 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	Svc service
}

func NewHander

func NewHander(svc service) *Handler

func (*Handler) Delete

func (h *Handler) Delete(w http.ResponseWriter, r *http.Request)

func (*Handler) GetAll

func (h *Handler) GetAll(w http.ResponseWriter, r *http.Request)

func (*Handler) Routes

func (h *Handler) Routes() []router.Route

func (*Handler) Update

func (h *Handler) Update(w http.ResponseWriter, r *http.Request)

type MongoDBRepository

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

func NewMongoDBRepo

func NewMongoDBRepo(session *mgo.Session) *MongoDBRepository

func (*MongoDBRepository) Create

func (r *MongoDBRepository) Create(ctx context.Context, comment *types.Comment) error

func (*MongoDBRepository) DeleteByID

func (r *MongoDBRepository) DeleteByID(ctx context.Context, id string) error

func (*MongoDBRepository) FindAll

func (r *MongoDBRepository) FindAll(ctx context.Context) ([]*types.Comment, error)

func (*MongoDBRepository) FindCommentPost

func (r *MongoDBRepository) FindCommentPost(ctx context.Context, idPost string) ([]*types.Comment, error)

func (*MongoDBRepository) Update

func (r *MongoDBRepository) Update(ctx context.Context, id string, c string) error

type PolicyService

type PolicyService interface {
	AddPolicy(ctx context.Context, req types.Policy) error
	Validate(ctx context.Context, obj string, act string) error
}

type RepoProvider

type RepoProvider interface {
	FindAll(ctx context.Context) ([]*types.Comment, error)
	FindCommentPost(ctx context.Context, idPost string) ([]*types.Comment, error)
	Create(ctx context.Context, req *types.Comment) error
	Update(ctx context.Context, id string, c string) error
	DeleteByID(ctx context.Context, id string) error
}

type Service

type Service struct {
	Repo   RepoProvider
	Policy PolicyService
}

func NewService

func NewService(repo RepoProvider, policy PolicyService) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, req *types.Comment, idPost string) (*types.Comment, error)

func (*Service) DeleteByID

func (s *Service) DeleteByID(ctx context.Context, id string) error

func (*Service) GetAll

func (s *Service) GetAll(ctx context.Context) ([]*types.Comment, error)

func (*Service) GetCommentsPost

func (s *Service) GetCommentsPost(ctx context.Context, idPost string) ([]*types.Comment, error)

func (*Service) Update

func (s *Service) Update(ctx context.Context, id string, c *types.Comment) error

Jump to

Keyboard shortcuts

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