domain

package
v0.0.0-...-4ac0cf4 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	ClientID         int    `db:"cliente_id"`
	ClientName       string `db:"cliente_nombre"`
	ClientDirection  string `db:"cliente_direccion"`
	ClienteEmail     string `db:"cliente_email"`
	ClientePassword  string `db:"cliente_password"`
	ClienteTelephone string `db:"cliente_telefono"`
}

func (*User) ToUserResponse

func (user *User) ToUserResponse() UserResponse

type UserRepository

type UserRepository interface {
	GetAllUsers() ([]User, error)
	GetUserByID() (*User, error)
	UpdateUserByID() (*User, error)
	DeleteUserByID() ([]byte, error)
}

type UserRepositoryLocal

type UserRepositoryLocal struct {
}

func NewUserRepositoryLocal

func NewUserRepositoryLocal() *UserRepositoryLocal

NewUserRepositoryLocal initializes a new instance of UserRepositoryLocal.

It takes a client parameter of type *sqlx.DB and returns an instance of UserRepository.

func (*UserRepositoryLocal) DeleteUserByID

func (repo *UserRepositoryLocal) DeleteUserByID() ([]byte, error)

DeleteUserByID deletes a user from the local user repository based on the user ID. It marshals the string "User deleted" into a byte slice and returns it along with a nil error.

func (*UserRepositoryLocal) GetAllUsers

func (repo *UserRepositoryLocal) GetAllUsers() ([]User, error)

GetAllUsers returns all users from the local user repository.

It does not take any parameters. It returns a slice of UserResponse and an error.

func (*UserRepositoryLocal) GetUserByID

func (repo *UserRepositoryLocal) GetUserByID() (*User, error)

GetUserByID retrieves a user from the local user repository based on the user ID. It creates a new User struct with sample user data and returns a pointer to it along with a nil error.

func (*UserRepositoryLocal) UpdateUserByID

func (repo *UserRepositoryLocal) UpdateUserByID() (*User, error)

UpdateUserByID updates a user in the local user repository based on the user ID. It creates a new User struct with updated sample user data and returns a pointer to it along with a nil error.

type UserRequest

type UserRequest struct {
	ClienteEmail    string `json:"cliente_email"`
	ClientePassword string `json:"cliente_password"`
}

type UserResponse

type UserResponse struct {
	ClientID     int    `json:"cliente_id"`
	ClienteEmail string `json:"cliente_email"`
	ClientName   string `db:"cliente_nombre"`
}

Jump to

Keyboard shortcuts

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