postgres

package
v0.0.0-...-4ee43ae Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPostgresDB

func NewPostgresDB(ctx context.Context, cfg *config.DBConfig) (*pgx.Conn, error)

Types

type File

type File interface {
	Create(ctx context.Context, file *model.File) error
	FindByID(ctx context.Context, id string) (*model.File, error)
	FindUserFiles(ctx context.Context, userID string) ([]*model.File, error)
	AddPermission(ctx context.Context, fileID string, userID string) error
	HasPermission(ctx context.Context, fileID string, userID string) (bool, error)
	DeletePermission(ctx context.Context, fileID string, userID string) error
	Delete(ctx context.Context, id string) error
	FindPermissionsToFile(ctx context.Context, id string) ([]*model.Permission, error)
}

type FileRepo

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

func NewFileRepo

func NewFileRepo(db *pgx.Conn) *FileRepo

func (*FileRepo) AddPermission

func (r *FileRepo) AddPermission(ctx context.Context, fileID string, userID string) error

func (*FileRepo) Create

func (r *FileRepo) Create(ctx context.Context, file *model.File) error

func (*FileRepo) Delete

func (r *FileRepo) Delete(ctx context.Context, id string) error

func (*FileRepo) DeletePermission

func (r *FileRepo) DeletePermission(ctx context.Context, fileID string, userID string) error

func (*FileRepo) FindByID

func (r *FileRepo) FindByID(ctx context.Context, id string) (*model.File, error)

func (*FileRepo) FindPermissionsToFile

func (r *FileRepo) FindPermissionsToFile(ctx context.Context, id string) ([]*model.Permission, error)

func (*FileRepo) FindUserFiles

func (r *FileRepo) FindUserFiles(ctx context.Context, userID string) ([]*model.File, error)

func (*FileRepo) HasPermission

func (r *FileRepo) HasPermission(ctx context.Context, fileID string, userID string) (bool, error)

type PostgresRepository

type PostgresRepository struct {
	File
}

func NewPostgresRepo

func NewPostgresRepo(db *pgx.Conn) *PostgresRepository

Jump to

Keyboard shortcuts

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