users

package
v0.0.0-...-db75719 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository interface {
	CreateUser(ctx context.Context, user *User) error
	GetUsers(ctx context.Context, afterId string, limit int32) ([]User, error)
	GetUserByEmail(ctx context.Context, email string) (*User, error)
	GetUserByID(ctx context.Context, id string) (*User, error)
}

type User

type User struct {
	ID          string    `json:"id" bson:"_id,omitempty"`
	FullName    string    `json:"fullName" bson:"fullName,omitempty"`
	Email       string    `json:"email" bson:"email,omitempty"`
	Password    string    `json:"password" bson:"password,omitempty"`
	Country     string    `json:"country" bson:"country,omitempty"`
	TimeAdded   time.Time `json:"timeAdded" bson:"timeAdded,omitempty"`
	LastUpdated time.Time `json:"lastUpdated" bson:"lastUpdated,omitempty"`
}

type UserRepo

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

func NewRepository

func NewRepository(db *mongo.Database, tracer opentracing.Tracer) *UserRepo

NewRepository returns a new user repository object that implements the Repository interface.

func (*UserRepo) CreateUser

func (r *UserRepo) CreateUser(ctx context.Context, newUser *User) error

CreateUser adds a new user to the database.

func (*UserRepo) GetUserByEmail

func (r *UserRepo) GetUserByEmail(ctx context.Context, email string) (*User, error)

func (*UserRepo) GetUserByID

func (r *UserRepo) GetUserByID(ctx context.Context, id string) (*User, error)

func (*UserRepo) GetUsers

func (r *UserRepo) GetUsers(ctx context.Context, afterId string, limit int32) ([]User, error)

Jump to

Keyboard shortcuts

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