biz

package
v0.0.0-...-51342a6 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is biz providers.

Functions

This section is empty.

Types

type Session

type Session struct {
	Id           string
	UserAgent    string
	ClientIp     string
	ExpiresAt    time.Time
	RefreshToken string
}

type SessionRepo

type SessionRepo interface {
	SetSession(context.Context, Session) error
	GetSession(context.Context, string) (*Session, error)
}

type SessionUsecase

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

func NewSessionUsecase

func NewSessionUsecase(repo SessionRepo, logger log.Logger) *SessionUsecase

func (*SessionUsecase) GetSession

func (uc *SessionUsecase) GetSession(ctx context.Context, id string) (*Session, error)

func (*SessionUsecase) SetSession

func (uc *SessionUsecase) SetSession(ctx context.Context, s Session) error

type TokenPayload

type TokenPayload struct {
	UserId    string `json:"user_id"`
	SessionId string `json:"session_id"`

	jwt.RegisteredClaims
}

type TokenUsecase

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

func NewTokenUsecase

func NewTokenUsecase(c *conf.Token) *TokenUsecase

func (*TokenUsecase) CreateToken

func (uc *TokenUsecase) CreateToken(userId string, sessionId string, duration time.Time) (string, error)

func (*TokenUsecase) ValidateToken

func (uc *TokenUsecase) ValidateToken(signedToken string) error

type UserRepo

type UserRepo interface {
	CreateUser(context.Context, *v1.CreateUserRequest) (*v1.User, error)
	GetUserById(context.Context, *v1.GetUserByIdRequest) (*v1.User, error)
	GetUserByEmail(context.Context, *v1.GetUserByEmailRequest) (*v1.GetUserByEmailReply, error)
}

type UserUsecase

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

func NewUserUsecase

func NewUserUsecase(repo UserRepo, logger log.Logger) *UserUsecase

func (*UserUsecase) CreateUser

func (uc *UserUsecase) CreateUser(ctx context.Context, r *v1.CreateUserRequest) (*v1.User, error)

func (*UserUsecase) GetUserByEmail

Jump to

Keyboard shortcuts

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