Documentation ¶
Index ¶
- func NewClient(logger log.Logger, conf *config.Config) (v1.UserServiceClient, error)
- func NewServer(logger log.Logger, repo Repository) v1.UserServiceServer
- type Repository
- type Server
- func (s Server) CreateUser(ctx context.Context, req *v1.CreateUserRequest) (*v1.CreateUserResponse, error)
- func (s Server) DeleteUser(ctx context.Context, req *v1.DeleteUserRequest) (*v1.DeleteUserResponse, error)
- func (s Server) GetUser(ctx context.Context, req *v1.GetUserRequest) (*v1.GetUserResponse, error)
- func (s Server) GetUserByEmail(ctx context.Context, req *v1.GetUserByEmailRequest) (*v1.GetUserResponse, error)
- func (s Server) GetUserByUsername(ctx context.Context, req *v1.GetUserByUsernameRequest) (*v1.GetUserResponse, error)
- func (s Server) ListUsersByIDs(ctx context.Context, req *v1.ListUsersByIDsRequest) (*v1.ListUsersByIDsResponse, error)
- func (s Server) UpdateUser(ctx context.Context, req *v1.UpdateUserRequest) (*v1.UpdateUserResponse, error)
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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"` }
Click to show internal directories.
Click to hide internal directories.