article

package
v0.0.0-...-c4bde49 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteCommentEndpoint

func DeleteCommentEndpoint(a realworld.ArticleService) endpoint.Endpoint

Types

type AddCommentRequest

type AddCommentRequest struct {
	Slug   string
	UserID int64
	Body   string
}

type Article

type Article struct {
	Slug           string
	Title          string
	Description    string
	Body           string
	Tags           realworld.Tags
	Favorited      bool
	FavoritesCount int
	Author         Author
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

type Author

type Author struct {
	Username  string
	Bio       realworld.Bio
	Image     realworld.Image
	Following bool
}

type Comment

type Comment struct {
	ID        int64
	Body      string
	Author    Author
	CreatedAt time.Time
	UpdatedAt time.Time
}

type CommentResponse

type CommentResponse struct {
	Comment
	Err error
}

func NewCommentResponse

func NewCommentResponse(c *realworld.Comment, u *realworld.User, userSrv realworld.UserService, err error) CommentResponse

func (CommentResponse) Failed

func (r CommentResponse) Failed() error

type CommentsRequest

type CommentsRequest struct {
	UserID int64
	Slug   string
}

type CommentsResponse

type CommentsResponse struct {
	Comments []Comment
	Err      error
}

func NewCommentsResponse

func NewCommentsResponse(
	cc []*realworld.Comment, u *realworld.User, userSrv realworld.UserService, err error,
) CommentsResponse

type CreateRequest

type CreateRequest struct {
	UserID      int64
	Title       string
	Description string
	Body        string
	Tags        []string
}

type DeleteCommentRequest

type DeleteCommentRequest struct {
	ID     int64
	Slug   string
	UserID int64
}

type DeleteRequest

type DeleteRequest struct {
	UserID int64
	Slug   string
}

type DeleteResponse

type DeleteResponse struct {
	Err error
}

type FavoriteRequest

type FavoriteRequest struct {
	UserID int64
	Slug   string
}

type GetRequest

type GetRequest struct {
	UserID int64
	Slug   string
}

type ListRequest

type ListRequest struct {
	UserID int64
	Tag    string
	Author string

	Favoriter string

	Limit  int
	Offset int
	// contains filtered or unexported fields
}

type ListResponse

type ListResponse struct {
	Articles []Article
	Count    int
	Err      error
}

func NewListResponse

func NewListResponse(
	articles []*realworld.Article, count int, u *realworld.User, userSrv realworld.UserService, err error,
) ListResponse

func (ListResponse) Failed

func (r ListResponse) Failed() error

type Response

type Response struct {
	Article
	Err error
}

func NewResponse

func NewResponse(a *realworld.Article, u realworld.User, userSrv realworld.UserService, err error) Response

func (Response) Failed

func (r Response) Failed() error

func (Response) TagsList

func (r Response) TagsList() (tt []string)

type Service

type Service struct {
	Repo realworld.ArticleRepo
}

func (Service) AddComment

func (s Service) AddComment(c realworld.Comment) (*realworld.Comment, error)

func (Service) Comments

func (s Service) Comments(a realworld.Article) ([]*realworld.Comment, error)

func (Service) Create

func (s Service) Create(a realworld.Article) (*realworld.Article, error)

func (Service) Delete

func (s Service) Delete(a realworld.Article) error

func (Service) DeleteComment

func (s Service) DeleteComment(c realworld.Comment) error

func (Service) Favorite

func (Service) Feed

func (s Service) Feed(req realworld.FeedRequest) ([]*realworld.Article, int, error)

func (Service) Get

func (Service) List

func (s Service) List(req realworld.ListRequest) ([]*realworld.Article, int, error)

func (Service) Tags

func (s Service) Tags() ([]*realworld.Tag, error)

func (Service) Unfavorite

func (s Service) Unfavorite(a realworld.Article, u realworld.User) (*realworld.Article, error)

func (Service) Update

func (s Service) Update(slug string, a realworld.Article) (*realworld.Article, error)

type TagsRequest

type TagsRequest struct{}

type TagsResponse

type TagsResponse struct {
	Tags []*realworld.Tag
	Err  error
}

func (TagsResponse) Failed

func (r TagsResponse) Failed() error

type UpdateRequest

type UpdateRequest struct {
	TargetSlug  string
	Slug        string
	UserID      int64
	Title       string
	Description string
	Body        string
	Tags        []string
}

Jump to

Keyboard shortcuts

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