repositories

package
v0.0.0-...-e5441ae Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuthRepo

func NewAuthRepo(conf *config.Config) domain.AuthRepo

func NewBlogRepo

func NewBlogRepo(conf *config.Config, client *pgxpool.Pool) domain.BlogRepo

func NewDatabaseRepo

func NewDatabaseRepo(conf *config.Config, client *pgxpool.Pool, userRepo domain.UserRepo) domain.DatabaseRepo

func NewUserRepo

func NewUserRepo(conf *config.Config, client *pgxpool.Pool, sessionRepo domain.AuthRepo) domain.UserRepo

Types

type AuthRepo

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

func (*AuthRepo) GetToken

func (r *AuthRepo) GetToken(ctx context.Context, userID int64, permissions map[string]any) (string, error)

type BlogRepo

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

func (*BlogRepo) Create

func (r *BlogRepo) Create(ctx context.Context, newBlog *domain.Blog) (int64, error)

func (*BlogRepo) Get

func (r *BlogRepo) Get(ctx context.Context, blogID int64) (*domain.Blog, error)

func (*BlogRepo) Search

func (r *BlogRepo) Search(ctx context.Context, offset int, limit int, search string) ([]*domain.Blog, error)

type DatabaseRepo

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

DatabaseRepo functionalities of this repo is very specific to the initialization of the database tables creating roles and an admin user.

func (*DatabaseRepo) Initialize

func (r *DatabaseRepo) Initialize(ctx context.Context) error

type UserRepo

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

func (*UserRepo) AssignRoles

func (r *UserRepo) AssignRoles(ctx context.Context, userID int64, roleIDs ...int64) error

func (*UserRepo) Create

func (r *UserRepo) Create(ctx context.Context, newUser *domain.User) (*domain.User, error)

func (*UserRepo) GetRoleByName

func (r *UserRepo) GetRoleByName(ctx context.Context, roleName string) (*domain.Role, error)

func (*UserRepo) GetUserByUsername

func (r *UserRepo) GetUserByUsername(ctx context.Context, uname string) (*domain.User, error)

func (*UserRepo) Login

func (r *UserRepo) Login(ctx context.Context, username string, password string) (string, error)

Jump to

Keyboard shortcuts

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