persistence

package
v0.0.0-...-3b7b480 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package persistence implements the restaurant repository using GORM for PostgreSQL It implements the restaurant.Repository interface defined in the restaurant domain, providing methods for creating, retrieving, updating, and deleting restaurant records in a PostgreSQL database using GORM as the ORM.

Package persistence implements the user repository using PostgreSQL as the database. It implements the UserRepository interface defined in the user domain, providing methods for creating, retrieving, updating, and deleting user records in a PostgreSQL database using GORM as the ORM.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRestaurantRepository

func NewRestaurantRepository(db *gorm.DB,
	log *zerolog.Logger,
) *restaurantRepository

NewRestaurantRepository creates a new instance of the GORM repository

func NewUserRepository

func NewUserRepository(db *gorm.DB, log *zerolog.Logger) user.Repository

Types

type UserSessionRepository

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

func NewUserSessionRepository

func NewUserSessionRepository(
	db *gorm.DB,
	log *zerolog.Logger) *UserSessionRepository

func (*UserSessionRepository) Create

func (r *UserSessionRepository) Create(
	ctx context.Context,
	entity *session.UserSessions,
) error

Create creates a new user session in the database

func (*UserSessionRepository) DeleteByToken

func (r *UserSessionRepository) DeleteByToken(
	ctx context.Context,
	token string,
) error

DeleteByToken deletes a user session by its token Delete from database first, then redis

func (*UserSessionRepository) DeleteByUserID

func (r *UserSessionRepository) DeleteByUserID(
	ctx context.Context,
	userID uuid.UUID,
) error

DeleteByUserID deletes all user sessions for a given user ID Delete from database first, then redis

func (*UserSessionRepository) GetByToken

func (r *UserSessionRepository) GetByToken(
	ctx context.Context,
	token string,
) (*session.UserSessions, error)

GetByToken retrieves a user session by its token from database

func (*UserSessionRepository) GetByUserID

func (r *UserSessionRepository) GetByUserID(
	ctx context.Context,
	userID uuid.UUID,
) ([]session.UserSessions, error)

GetByUserID retrieves all user sessions for a given user ID

func (*UserSessionRepository) Update

func (r *UserSessionRepository) Update(
	ctx context.Context,
	entity *session.UserSessions,
) error

Update user session in database

Jump to

Keyboard shortcuts

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