repository

package
v0.0.0-...-3854a10 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func HashingPass

func HashingPass(password string) (string, error)

Types

type Auth

type Auth interface {
	Register(user entity.User) error
	Login(password, email string) (status bool, user entity.User)
	SaveSession(token string, userID int, timeEXP time.Time) (int, error)
}

type JWT

type JWT interface {
	DeleteSession(sessionID int)
	SessionExist(token string) (user entity.User, sessionID int, err error)
}

type MainDB

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

func NewDB

func NewDB(db *sql.DB) *MainDB

func (*MainDB) CreateNews

func (r *MainDB) CreateNews(article entity.Article) (int, error)

func (*MainDB) DeleteNews

func (r *MainDB) DeleteNews(article entity.Article)

func (*MainDB) DeleteSession

func (r *MainDB) DeleteSession(id int)

func (*MainDB) Login

func (r *MainDB) Login(password, email string) (bool, entity.User)

func (*MainDB) Register

func (r *MainDB) Register(user entity.User) error

func (*MainDB) SaveSession

func (r *MainDB) SaveSession(session string, userID int, time time.Time) (int, error)

func (*MainDB) SessionExist

func (r *MainDB) SessionExist(session string) (user entity.User, sessionID int, err error)

type News

type News interface {
	CreateNews(entity.Article) (int, error)
	DeleteNews(entity.Article)
}

type Repository

type Repository struct {
	News
	Auth
	JWT
}

func NewRep

func NewRep(db *sql.DB) *Repository

Jump to

Keyboard shortcuts

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