postgres

package
v0.0.0-...-9896131 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CreatedAt time.Time
	UpdatedAt time.Time
)

Functions

func HandleDatabaseError

func HandleDatabaseError(err error, log *logger.Logger, message string) error

Types

type PostgresI

type PostgresI interface {
	// common
	UpdateSingleField(ctx context.Context, req *models.UpdateSingleFieldReq) error
	CheckIfExists(ctx context.Context, req *models.CheckIfExistsReq) (*models.CheckIfExistsRes, error)

	// User
	UserCreate(ctx context.Context, req *models.UserCreateReq) (*models.UserResponse, error)
	UserGet(ctx context.Context, req *models.UserGetReq) (*models.UserResponse, error)
	UserFind(ctx context.Context, req *models.UserFindReq) (*models.UserFindResponse, error)
	UserUpdate(ctx context.Context, req *models.UserUpdateReq) (*models.UserResponse, error)
	UserDelete(ctx context.Context, req *models.UserDeleteReq) error

	// Post
	PostCreate(ctx context.Context, req *models.PostCreateReq) (*models.PostResponse, error)
	PostGet(ctx context.Context, req *models.PostGetReq) (*models.PostResponse, error)
	PostFind(ctx context.Context, req *models.PostFindReq) (*models.PostFindResponse, error)
	PostUpdate(ctx context.Context, req *models.PostUpdateReq) (*models.PostResponse, error)
	PostDelete(ctx context.Context, req *models.PostDeleteReq) error

	// Comment
	CommentCreate(ctx context.Context, req *models.CommentCreateReq) (*models.CommentResponse, error)
	CommentGet(ctx context.Context, req *models.CommentGetReq) (*models.CommentResponse, error)
	CommentFind(ctx context.Context, req *models.CommentFindReq) (*models.CommentFindResponse, error)
	CommentUpdate(ctx context.Context, req *models.CommentUpdateReq) (*models.CommentResponse, error)
	CommentDelete(ctx context.Context, req *models.CommentDeleteReq) error
}

func New

func New(db *db.Postgres, log *logger.Logger, cfg config.Config) PostgresI

Jump to

Keyboard shortcuts

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