user

package
v0.0.0-...-cff5d44 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SubjectCreated = "User.Created"
)

Variables

View Source
var (
	NotFound           = rescode.New(2000, http.StatusNotFound, codes.NotFound, "user_not_found")
	Disabled           = rescode.New(2001, http.StatusForbidden, codes.Unavailable, "user_disabled")
	VerifyRequired     = rescode.New(2002, http.StatusForbidden, codes.Unavailable, "user_verify_required")
	EmailAlreadyExists = rescode.New(2003, http.StatusConflict, codes.AlreadyExists, "email_already_exists")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Name  string `example:"John Doe"`
	Email string `example:"john@doe.com"`
}

type EventCreated

type EventCreated struct {
	Name      string `json:"name"`
	Email     string `json:"email"`
	TempToken string `json:"temp_token"`
}

type FindByEmailOpts

type FindByEmailOpts struct {
	Email string `example:"john@doe.com"`
}

type FindByIdOpts

type FindByIdOpts struct {
	ID uuid.UUID `example:"550e8400-e29b-41d4-a716-446655440000"`
}

type FindByTokenOpts

type FindByTokenOpts struct {
	Token string
}

type IsExistsByEmailOpts

type IsExistsByEmailOpts struct {
	Email string `example:"john@doe.com"`
}

type Repo

type Repo interface {
	FindByEmail(ctx context.Context, t trace.Tracer, opts FindByEmailOpts) (*User, error)
	FindById(ctx context.Context, t trace.Tracer, opts FindByIdOpts) (*User, error)
	FindByToken(ctx context.Context, t trace.Tracer, opts FindByTokenOpts) (*User, error)
	IsExistsByEmail(ctx context.Context, t trace.Tracer, opts IsExistsByEmailOpts) (bool, error)
	Save(ctx context.Context, t trace.Tracer, opts SaveOpts) error
}

type SaveOpts

type SaveOpts struct {
	User *User `example:"{}"`
}

type User

type User struct {
	ID         uuid.UUID  `json:"id"`
	Name       string     `json:"name"`
	Email      string     `json:"email"`
	IsActive   bool       `json:"is_active"`
	TempToken  *string    `json:"temp_token"`
	VerifiedAt *time.Time `json:"verified_at"`
	CreatedAt  time.Time  `json:"created_at"`
	UpdatedAt  time.Time  `json:"updated_at"`
	DeletedAt  time.Time  `json:"deleted_at"`
}

func New

func New(cnf Config) *User

func (*User) Disable

func (u *User) Disable()

func (*User) Enable

func (u *User) Enable()

func (*User) Verify

func (u *User) Verify()

Jump to

Keyboard shortcuts

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