repositories

package
v0.0.0-...-5ba66fb Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: MIT Imports: 4 Imported by: 0

README

Repository Layer

  • Purpose: The repository layer is primarily concerned with data access. Its main responsibility is to interact with the database or any data source.
  • Functions: It handles CRUD (Create, Read, Update, Delete) operations and essentially acts as a bridge between the business logic and the database.
  • Abstraction: By abstracting database access, it allows the rest of the application to interact with the database without needing to know the details of the underlying data source.
  • Benefits: This layer makes it easier to manage changes to the database schema, switch databases, or change data access technologies without affecting the business logic.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommentRepository

type CommentRepository interface {
	SaveComment(ctx context.Context, comment *models.Comment) error
	GetCommentsByVideoID(ctx context.Context, videoID string) ([]models.Comment, error)
}

func NewCommentRepository

func NewCommentRepository(db *firestore.Client) CommentRepository

type LikeRepository

type LikeRepository interface {
	SaveLike(ctx context.Context, like *models.Like) error
	GetLikesByVideoID(ctx context.Context, videoID string) ([]models.Like, error)
}

func NewLikeRepository

func NewLikeRepository(db *firestore.Client) LikeRepository

type UserRepository

type UserRepository interface {
	CreateUser(ctx context.Context, user *models.User) error
	GetUserByID(ctx context.Context, id string) (*models.User, error)
}

func NewUserRepository

func NewUserRepository(db *firestore.Client) UserRepository

type VideoRepository

type VideoRepository interface {
	SaveVideo(ctx context.Context, video *models.Video) error
	GetVideos(ctx context.Context) ([]models.Video, error)
}

func NewVideoRepository

func NewVideoRepository(db *firestore.Client) VideoRepository

Jump to

Keyboard shortcuts

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