user

package
v0.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderSet = wire.NewSet(NewUserFactory)

Functions

This section is empty.

Types

type ChangePasswordReq

type ChangePasswordReq pb.ChangePasswordRequest

type Config

type Config struct {
	Type         Type   `json:"type"`
	JWTSecretKey string `json:"jwtSecretKey"`
}

type CurrentUser

type CurrentUser struct {
	Username    string                 `json:"username"`
	Email       string                 `json:"email"`
	PhoneNumber string                 `json:"phoneNumber"`
	ExtraInfo   map[string]interface{} `json:"extraInfo"`
}

type IRepoUser

type IRepoUser interface {
	Create(ctx context.Context, user *User) error
	Update(ctx context.Context, id int64, updateFields map[string]interface{}) error
	Delete(ctx context.Context, user *User) error
	GetByUsername(ctx context.Context, username string) (*User, error)
	GetByID(ctx context.Context, id int64) (*User, error)
}

type Interface

type Interface interface {
	SignUp(ctx context.Context, user *User) error
	GetCurrentUser(ctx context.Context) (user selfJwt.CurrentUser, err error)
	Login(ctx context.Context, username, password string) (string, error)
	ChangePassword(ctx context.Context, req *ChangePasswordReq) error
	GetUserByUsername(ctx context.Context, username string) (*User, error)
}

func NewDefaultUser

func NewDefaultUser(uRepo IRepoUser, c *Config) Interface

func NewUserFactory

func NewUserFactory(userRepo IRepoUser, c *conf.Server) (Interface, error)

type Type

type Type string
const (
	TypeDefault Type = "DEFAULT"
)

func (Type) String

func (t Type) String() string

type User

type User struct {
	ID          int64                  `json:"id"`
	Username    string                 `json:"username"`
	Password    string                 `json:"password"`
	Email       string                 `json:"email"`
	PhoneNumber string                 `json:"phoneNumber"`
	ExtraInfo   map[string]interface{} `json:"extraInfo"`
}

Jump to

Keyboard shortcuts

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