auth

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserAlreadyExist     = errors.New("user already exist")
	ErrUserNotFound         = errors.New("user not found")
	ErrTokenCannotBeCreated = errors.New("token cannot be created")
)

Functions

This section is empty.

Types

type Repository

type Repository interface {
	CreateUser(ctx context.Context, user auth.User) error
	GetUserByUsername(ctx context.Context, username string) (auth.User, error)
	ListUsers(ctx context.Context) ([]auth.User, error)
	ListUsersByIsActivated(ctx context.Context, isActivated bool) ([]auth.User, error)
	ActivateUser(ctx context.Context, username string) error
	DeleteUserByUsername(ctx context.Context, username string) error

	CreateToken(ctx context.Context, token string, user auth.User, expiresBy time.Time) error
	GetUserByToken(ctx context.Context, token string) (auth.User, error)
}

func NewMongo

func NewMongo(mongoUri, database string) (Repository, error)

Jump to

Keyboard shortcuts

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