Documentation
¶
Index ¶
- type Client
- func (c *Client) CreateProduct(product *Product) (*Product, error)
- func (c *Client) CreateUser(user *User) (*User, error)
- func (c *Client) DeleteProduct(id int) error
- func (c *Client) DeleteUser(id int) error
- func (c *Client) GetProductByID(id int) (*Product, error)
- func (c *Client) GetProducts() ([]Product, error)
- func (c *Client) GetUserByID(id int) (*User, error)
- func (c *Client) GetUsers() ([]User, error)
- func (c *Client) UpdateProduct(product *Product) (*Product, error)
- func (c *Client) UpdateUser(user *User) (*User, error)
- type Product
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client
func (*Client) CreateProduct ¶
CreateProduct - Create a new product
func (*Client) CreateUser ¶
CreateUser - Creates a new user (no auth required)
func (*Client) DeleteProduct ¶
DeleteProduct - Delete a product by ID
func (*Client) DeleteUser ¶
DeleteUser - Deletes a user by ID (no auth required)
func (*Client) GetProductByID ¶
GetProductByID - Get product by ID
func (*Client) GetProducts ¶
func (*Client) GetUserByID ¶
GetUserByID - Returns a user by ID (no auth required)
func (*Client) UpdateProduct ¶
UpdateProduct - Update an existing product (no auth required)
type Product ¶
type Product struct {
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Price float64 `json:"price,omitempty"`
Stock int `json:"stock,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
Type string `json:"type,omitempty"`
Department string `json:"department,omitempty"`
}
func (Product) MarshalJSON ¶
Implementinc custom marshaler for Product
func (*Product) UnmarshalJSON ¶
UnmarshalJSON - Custom unmarshal for Product struct
type User ¶
type User struct {
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
LastName string `json:"lastName,omitempty"`
Address string `json:"address,omitempty"`
FavoriteDogBreed string `json:"favoriteDogBreed,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
}
func (User) MarshalJSON ¶
Implementing custom marshaler for User
func (*User) UnmarshalJSON ¶
Implementing custom unmarshaler for User
Click to show internal directories.
Click to hide internal directories.