service

package
v0.0.0-...-adf70e8 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotFound    = errors.New("user not found")
	ErrUsernameTaken   = errors.New("username taken")
	ErrInvalidEmail    = errors.New("invalid email")
	ErrInvalidUsername = errors.New("invalid username")
)
View Source
var (
	ErrInvalidPostContent = errors.New("invalid post content")
	ErrUnauthenticated    = errors.New("unauthenticated")
)
View Source
var (
	ErrCannotFollowSelf = errors.New("cannon follow self")
)
View Source
var (
	ErrInvalidCommentContent = errors.New("invalid comment content")
)

Functions

This section is empty.

Types

type Service

type Service struct {
	Queries *queries.Queries
	Logger  *log.Logger
	Store   *sessions.CookieStore
	Payload map[string]interface{}
}

func New

func New() *Service

func (*Service) CreateComment

func (svc *Service) CreateComment(userID, postID, content string, loggedIn bool) (model.Comment, error)

func (*Service) CreatePost

func (svc *Service) CreatePost(content, userID string, loggedIn bool) error

func (*Service) FollowUser

func (svc *Service) FollowUser(userID string, followUserID string) error

func (*Service) GetComments

func (svc *Service) GetComments(postID string) ([]model.Comment, error)

func (*Service) GetFollowingPosts

func (svc *Service) GetFollowingPosts(ids []interface{}) ([]model.Post, error)

func (*Service) GetFollowingUser

func (svc *Service) GetFollowingUser(username, followingID string) (model.User, error)

func (*Service) GetPostByID

func (svc *Service) GetPostByID(id string) (model.Post, error)

func (*Service) GetPosts

func (svc *Service) GetPosts() ([]model.Post, error)

func (*Service) GetPostsByUsername

func (svc *Service) GetPostsByUsername(username string) ([]model.Post, error)

func (*Service) GetUserByUsername

func (svc *Service) GetUserByUsername(username string) (model.User, error)

func (*Service) Login

func (svc *Service) Login(email, username string) (model.User, error)

func (*Service) Pop

func (svc *Service) Pop(key string) (interface{}, bool)

func (*Service) Push

func (svc *Service) Push(key string, value interface{})

func (*Service) UnfollowUser

func (svc *Service) UnfollowUser(userID string, followUserID string) error

Jump to

Keyboard shortcuts

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