repository

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMySql

func NewMySql(cfg *config.DBConfig) (*sqlx.DB, error)

Types

type CommentRepository

type CommentRepository interface {
	Create(postId int, input model.CommentInput) (int, error)
	GetAll(postId int) ([]model.Comment, error)
	UpdateById(commentId int, input model.CommentInput) error
	DeleteById(commentId int) error
}

type PostRepository

type PostRepository interface {
	Create(input model.PostInput) (int, error)
	GetAll() ([]model.Post, error)
	GetById(postId int) (model.Post, error)
	UpdateById(postId int, input model.PostInput) error
	DeleteById(postId int) error
}

type Repository

type Repository struct {
	UserRepository
	PostRepository
	CommentRepository
}

func New

func New(db *sqlx.DB) *Repository

type UserRepository

type UserRepository interface {
	Create(input model.UserInput) (int, error)
	Get(email string) (model.User, error)
	GetAll() ([]model.UserOutput, error)
	GetById(userId int) (model.UserOutput, error)
	UpdateById(userId int, input model.UserInput) error
	DeleteById(userId int) error
}

Jump to

Keyboard shortcuts

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