Documentation ¶
Index ¶
- type Comment
- type CommentId
- type CommentRepository
- type CommentService
- type GitHubClient
- type GitHubCreator
- type GitHubInterface
- type Post
- type PostId
- type PostRepository
- type PostService
- type React
- type ReactRepository
- type ReactService
- type ReactViews
- type RepositoriesService
- type User
- type UsersService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comment ¶
type Comment struct { ID CommentId `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` ParentPostID uint64 `db:"parent_post_id" json:"parent_post_id"` ParentID *int `db:"parent_id" json:"parent_id"` // allow nullable on lvl 0 comment AuthorID uint64 `db:"author_id" json:"author_id"` AuthorUsername *string `db:"username" json:"author_username"` Content string `db:"content" json:"content"` ReactViews []*ReactViews `json:"react_views"` Replies []*Comment `json:"replies"` }
type CommentRepository ¶
type CommentService ¶
type CommentService struct {
// contains filtered or unexported fields
}
func NewCommentService ¶
func NewCommentService(repo CommentRepository) *CommentService
func (CommentService) CreateComment ¶
func (c CommentService) CreateComment(comment *Comment) error
func (CommentService) GetCommentByID ¶
func (c CommentService) GetCommentByID(commentId CommentId) *Comment
type GitHubClient ¶
type GitHubClient struct { Repositories RepositoriesService Users UsersService }
GitHubClient manages communication with the GitHub API. https://github.com/google/go-github/issues/113
type GitHubCreator ¶
type GitHubCreator struct{}
func (*GitHubCreator) NewClient ¶
func (g *GitHubCreator) NewClient(httpClient *http.Client) GitHubClient
NewClient returns a new GitHubInterface instance.
type GitHubInterface ¶
type GitHubInterface interface {
NewClient(httpClient *http.Client) GitHubClient
}
GitHubInterface defines all necessary methods. https://godoc.org/github.com/google/go-github/github#NewClient
type Post ¶
type Post struct { ID PostId `db:"id" json:"id"` AuthorID uint64 `db:"author_id" json:"author_id"` AuthorUsername string `db:"username" json:"author_username"` Title string `db:"title" json:"title"` // # TODO add field validation before insert Content string `db:"content" json:"content"` ReactViews []*ReactViews `json:"react_views"` Replies []*Comment `json:"replies"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` }
type PostRepository ¶
type PostService ¶
type PostService struct {
// contains filtered or unexported fields
}
func NewPostService ¶
func NewPostService(postRepo PostRepository, commentRepo CommentRepository, reactRepo ReactRepository) *PostService
func (PostService) CreatePost ¶
func (p PostService) CreatePost(payload *Post) error
func (PostService) GetPostByID ¶
func (p PostService) GetPostByID(postID PostId) *Post
func (PostService) GetPostMany ¶
func (p PostService) GetPostMany(limit, pageNum int) []*Post
type React ¶
type React struct { ID uint64 `db:"id" json:"id"` AuthorID uint64 `db:"author_id" json:"author_id"` ReactID int `db:"react_id" json:"react_id"` PostID *uint64 `db:"post_id" json:"post_id"` CommentID *uint64 `db:"comment_id" json:"comment_id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` }
type ReactRepository ¶
type ReactRepository interface { InsertUserReact(react *React) error GetByPostID(PostId) []*ReactViews }
type ReactService ¶
type ReactService struct {
// contains filtered or unexported fields
}
func NewReactService ¶
func NewReactService(repository ReactRepository) *ReactService
func (*ReactService) AddReact ¶
func (r *ReactService) AddReact(react *React) error
type ReactViews ¶
type RepositoriesService ¶
type RepositoriesService interface {
Get(context.Context, string, string) (*github.Repository, *github.Response, error)
}
RepositoriesService handles communication with the repository related methods of the GitHub API. https://godoc.org/github.com/google/go-github/github#RepositoriesService
Click to show internal directories.
Click to hide internal directories.