users

package
v1.4.10 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	FirstName string     `json:"firstName,omitempty"`
	LastName  string     `json:"lastName,omitempty"`
	Mobile    string     `json:"mobile,omitempty"`
	Email     string     `json:"email,omitempty"`
	CreatedAt *time.Time `json:"createdAt,omitempty"`
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
}

User holds all data required to represent a user

func (*User) Sanitize

func (u *User) Sanitize()

Sanitize is used to sanitize/cleanup the fields of User

func (*User) Validate

func (u *User) Validate() error

Validate is used to validate the fields of User

type Users

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

Users struct holds all the dependencies required for the users package. And exposes all services provided by this package as its methods

func NewService

func NewService(l logger.Logger, pqdriver *pgxpool.Pool, redispool *redis.Pool) (*Users, error)

NewService initializes the Users struct with all its dependencies and returns a new instance all dependencies of Users should be sent as arguments of NewService

func (*Users) CreateUser

func (us *Users) CreateUser(ctx context.Context, u *User) (*User, error)

CreateUser creates a new user

func (*Users) ReadByEmail

func (us *Users) ReadByEmail(ctx context.Context, email string) (*User, error)

ReadByEmail returns a user which matches the given email

Jump to

Keyboard shortcuts

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