repository

package
v0.0.0-...-dc61bab Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeEmailSchema

type ChangeEmailSchema struct {
	UserID   primitive.ObjectID
	NewEmail string
}

type ChangePasswordSchema

type ChangePasswordSchema struct {
	UserID          primitive.ObjectID
	NewPasswordHash string
}

type Config

type Config struct {
	Use     string        `mapstructure:"use"`
	MongoDB MongoDBConfig `mapstructure:"mongodb"`
	FileDB  FileDBConfig  `mapstructure:"filedb"`
}

type FileDBConfig

type FileDBConfig struct {
	Path string `mapstructure:"path"`
}

type MongoDBConfig

type MongoDBConfig struct {
	URI      string `mapstructure:"uri"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	Database string `mapstructure:"database"`
}

type Repositories

type Repositories struct {
	Users UsersRepository
	// contains filtered or unexported fields
}

Repositories -.

func New

func New(ctx context.Context, cfg Config) (*Repositories, error)

func (*Repositories) Close

func (r *Repositories) Close(ctx context.Context) error

type UsersRepository

type UsersRepository interface {
	Create(ctx context.Context, user entity.UserModel) error
	FindByID(ctx context.Context, userID primitive.ObjectID) (entity.UserModel, error)
	FindByUsername(ctx context.Context, username string) (entity.UserModel, error)
	FindByEmail(ctx context.Context, email string) (entity.UserModel, error)
	FindByLogin(ctx context.Context, login string) (entity.UserModel, error)
	ChangeEmail(ctx context.Context, schema ChangeEmailSchema) error
	ChangePassword(ctx context.Context, schema ChangePasswordSchema) error
}

UsersRepository is a store for users

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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