post

package
v0.0.0-...-bf66428 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InvalidError

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

func (InvalidError) Error

func (e InvalidError) Error() string

type NotFoundError

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

func (NotFoundError) Error

func (e NotFoundError) Error() string

type Post

type Post struct {
	ID      int64
	Title   string
	Content string
	UserID  int64
}

type Service

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

func NewService

func NewService(userSvc user.Servicer) *Service

func (*Service) CreatePost

func (svc *Service) CreatePost(post *Post) (*Post, error)

func (*Service) DeletePost

func (svc *Service) DeletePost(id int64) error

func (*Service) GetPost

func (svc *Service) GetPost(id int64) (*Post, error)

func (*Service) ListPosts

func (svc *Service) ListPosts() []Post

func (*Service) UpdatePost

func (svc *Service) UpdatePost(id int64, post *Post) (*Post, error)

type Servicer

type Servicer interface {
	ListPosts() []Post
	GetPost(id int64) (*Post, error)
	CreatePost(pst *Post) (*Post, error)
	UpdatePost(id int64, pst *Post) (*Post, error)
	DeletePost(id int64) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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