// GetOne returns one post by id.
GetOne returns one post by id.
// GetOne returns one post by id .
func (pr *PostRepository) GetOne(ctx context.Context, id uint) (post.Post, error) {
	q := `
	SELECT id, body, user_id, created_at, updated_at
		FROM posts WHERE id = $1;
	`
	row := pr.Data.DB.QueryRowContext(ctx, q, id)
	var p post.Post
	err := row.Scan(&p.ID, &p.Body, &p.UserID, &p.CreatedAt, &p.UpdatedAt)
	if err != nil {
		return post.Post{}, err
	}
	return p, nil
}
func ( pr * PostRepository ) GetOne ( ctx context . Context , id uint ) ( post . Post , error ) { q := `
	SELECT id, body, user_id, created_at, updated_at
		FROM posts WHERE id = $1;
	` row := pr . Data . DB . QueryRowContext ( ctx , q , id ) var p post . Post err := row . Scan ( & p . ID , & p . Body , & p . UserID , & p . CreatedAt , & p . UpdatedAt ) if err != nil { return post . Post { } , err } return p , nil }
GetOne returns one post by id.
GetOne returns one post by id .