repository

package
v0.0.0-...-1b39580 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MySQL   string = "mysql"
	MongoDB string = "mongo"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoAdapter

type MongoAdapter struct {
	DB *mongo.Client
	// contains filtered or unexported fields
}

func (MongoAdapter) BeginTx

func (m MongoAdapter) BeginTx() *gorm.DB

func (MongoAdapter) ById

func (MongoAdapter) ByLogin

func (MongoAdapter) ChangePassword

func (m MongoAdapter) ChangePassword(ctx context.Context, userid int64, password string) error

func (MongoAdapter) ConfirmVerify

func (m MongoAdapter) ConfirmVerify(ctx context.Context, vCode string) error

func (MongoAdapter) FindOne

func (MongoAdapter) FindUserByID

func (m MongoAdapter) FindUserByID(uid int64) (*models.UserDBModel, error)

func (MongoAdapter) GetConnection

func (m MongoAdapter) GetConnection() *gorm.DB

func (MongoAdapter) Load

func (MongoAdapter) Save

func (m MongoAdapter) Save(ctx context.Context, user *models.UserDBModel) error

func (MongoAdapter) SingUp

func (m MongoAdapter) SingUp(user *models.UserDBModel) error

func (MongoAdapter) Update

func (m MongoAdapter) Update(ctx context.Context, user *models.UserDBModel) error

func (MongoAdapter) UpdateLastLogin

func (m MongoAdapter) UpdateLastLogin(ctx context.Context, u *models.UserDBModel) (*models.UserDBModel, error)

type Redis

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

func NewRedisRepository

func NewRedisRepository(redisClient redis.UniversalClient, log *logger.Logger) *Redis

func (Redis) PutUser

func (r Redis) PutUser(ctx context.Context, user models.UserDBModel) error

type UserAdapter

type UserAdapter struct {
	DB *gorm.DB
}

func (*UserAdapter) BeginTx

func (r *UserAdapter) BeginTx() *gorm.DB

func (*UserAdapter) ById

func (*UserAdapter) ByLogin

func (*UserAdapter) ChangePassword

func (r *UserAdapter) ChangePassword(ctx context.Context, userid int64, password string) error

func (*UserAdapter) ConfirmVerify

func (r *UserAdapter) ConfirmVerify(ctx context.Context, vCode string) error

func (*UserAdapter) FindOne

func (r *UserAdapter) FindOne(ctx context.Context, user *models.UserDBModel) (*models.UserDBModel, error)

func (*UserAdapter) FindUserByID

func (r *UserAdapter) FindUserByID(uid int64) (*models.UserDBModel, error)

func (*UserAdapter) GetConnection

func (r *UserAdapter) GetConnection() *gorm.DB

func (*UserAdapter) Load

func (*UserAdapter) Save

func (r *UserAdapter) Save(ctx context.Context, user *models.UserDBModel) error

func (*UserAdapter) SingUp

func (r *UserAdapter) SingUp(user *models.UserDBModel) error

func (*UserAdapter) Update

func (r *UserAdapter) Update(ctx context.Context, user *models.UserDBModel) error

func (*UserAdapter) UpdateLastLogin

func (r *UserAdapter) UpdateLastLogin(ctx context.Context, u *models.UserDBModel) (*models.UserDBModel, error)

type UserRepository

type UserRepository interface {
	FindOne(ctx context.Context, user *models.UserDBModel) (*models.UserDBModel, error)
	Save(ctx context.Context, user *models.UserDBModel) error
	Update(ctx context.Context, user *models.UserDBModel) error

	SingUp(user *models.UserDBModel) error
	Load(ctx context.Context, user *models.UserDBModel) (*models.UserDBModel, error)
	ById(ctx context.Context, id int64) (*models.UserDBModel, error)
	ByLogin(ctx context.Context, user *models.SignInUserRequest) (*models.UserDBModel, error)
	ConfirmVerify(ctx context.Context, vCode string) error
	UpdateLastLogin(ctx context.Context, u *models.UserDBModel) (*models.UserDBModel, error)
	FindUserByID(uid int64) (*models.UserDBModel, error)
	ChangePassword(ctx context.Context, userid int64, password string) error
	BeginTx() *gorm.DB
	GetConnection() *gorm.DB
}

func NewUserAdapter

func NewUserAdapter(db *gorm.DB) UserRepository

func NewUserRepository

func NewUserRepository(ctx context.Context, dbType string, params *config.Config) (UserRepository, error)

Jump to

Keyboard shortcuts

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