user

package
v0.0.0-...-5e7ffb8 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: Apache-2.0 Imports: 6 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 struct {
	// contains filtered or unexported fields
}

Repository struct

func NewRepository

func NewRepository(db *gorm.DB, logger log.Logger) *Repository

NewRepository creates a new user repository

func (Repository) Delete

func (r Repository) Delete(id string) error

Delete a user by ID

func (Repository) GetAll

func (r Repository) GetAll() ([]domain.User, error)

GetAll returns a list of users

func (Repository) GetByID

func (r Repository) GetByID(id string) (*domain.User, error)

GetByID get a user by its ID

func (Repository) Store

func (r Repository) Store(user *domain.User) (*domain.User, error)

Store creates an user

func (Repository) Update

func (r Repository) Update(entity *domain.User) (*domain.User, error)

Update the given user

type User

type User struct {
	ID          uuid.UUID `gorm:"type:uuid;primary_key;"`
	Email       string    `gorm:"unique;index;"`
	Password    string
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   *time.Time
	ActivatedAt *time.Time
}

User struct

func (*User) BeforeCreate

func (user *User) BeforeCreate(scope *gorm.Scope) error

BeforeCreate executes a hook before create the database entry

Jump to

Keyboard shortcuts

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