user

package
v0.0.0-...-704d0af Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	ID           int    `json:"id" bson:"_id"`
	Username     string `json:"username" bson:"username"`
	PasswordHash string `json:"passwordHash" bson:"password_hash"`
}

Model is the model of user

type Repository

type Repository interface {
	Migrate() error
	FindByID(context.Context, int, *Model) error
	FindByUsername(context.Context, string, *Model) error
}

func NewMongoRepository

func NewMongoRepository(client *mongo.Client) Repository

func NewPostgresRepository

func NewPostgresRepository(db *pgxpool.Pool) Repository

type Service

type Service interface {
	Authenticate(ctx context.Context, string, password string, user *Model) error
}

func NewService

func NewService(repo Repository) Service

Jump to

Keyboard shortcuts

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