user

package
v0.0.0-...-182277c Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(logger log.Logger, conf *config.Config) (v1.UserServiceClient, error)

func NewServer

func NewServer(logger log.Logger, repo Repository) v1.UserServiceServer

Types

type Repository

type Repository interface {
	ListUsersByIDs(ctx context.Context, ids []uint64) ([]*User, error)
	Get(ctx context.Context, id uint64) (*User, error)
	GetByEmail(ctx context.Context, email string) (*User, error)
	GetByUsername(ctx context.Context, username string) (*User, error)
	Create(ctx context.Context, user *User) error
	Update(ctx context.Context, user *User) error
	Delete(ctx context.Context, id uint64) error
}

func NewRepository

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

type Server

type Server struct {
	v1.UnimplementedUserServiceServer
	// contains filtered or unexported fields
}

func (Server) CreateUser

func (s Server) CreateUser(ctx context.Context, req *v1.CreateUserRequest) (*v1.CreateUserResponse, error)

func (Server) DeleteUser

func (s Server) DeleteUser(ctx context.Context, req *v1.DeleteUserRequest) (*v1.DeleteUserResponse, error)

func (Server) GetUser

func (s Server) GetUser(ctx context.Context, req *v1.GetUserRequest) (*v1.GetUserResponse, error)

func (Server) GetUserByEmail

func (s Server) GetUserByEmail(ctx context.Context, req *v1.GetUserByEmailRequest) (*v1.GetUserResponse, error)

func (Server) GetUserByUsername

func (s Server) GetUserByUsername(ctx context.Context, req *v1.GetUserByUsernameRequest) (*v1.GetUserResponse, error)

func (Server) ListUsersByIDs

func (s Server) ListUsersByIDs(ctx context.Context, req *v1.ListUsersByIDsRequest) (*v1.ListUsersByIDsResponse, error)

func (Server) UpdateUser

func (s Server) UpdateUser(ctx context.Context, req *v1.UpdateUserRequest) (*v1.UpdateUserResponse, error)

type User

type User struct {
	ID        uint64         `json:"id"`
	UUID      string         `json:"uuid"`
	Username  string         `json:"username"`
	Email     string         `json:"email"`
	Avatar    string         `json:"avatar"`
	Password  string         `json:"password"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"deleted_at"`
}

Jump to

Keyboard shortcuts

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