companies

package
v0.0.0-...-e4c3b48 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Company

type Company struct {
	ID          int    `json:"id" validate:"required"`
	Name        string `json:"name" validate:"required"`
	YearFounded int    `json:"year_founded" validate:"required"`
}

type CompanyHandler

type CompanyHandler struct {
	// contains filtered or unexported fields
}

func NewCompanyHandler

func NewCompanyHandler(repo CompanyRepository) *CompanyHandler

func (*CompanyHandler) CreateCompany

func (h *CompanyHandler) CreateCompany(w http.ResponseWriter, r *http.Request)

func (*CompanyHandler) GetCompanies

func (h *CompanyHandler) GetCompanies(w http.ResponseWriter, r *http.Request)

func (*CompanyHandler) GetCompanyByID

func (h *CompanyHandler) GetCompanyByID(w http.ResponseWriter, r *http.Request)

type CompanyRepository

type CompanyRepository interface {
	GetByID(ctx context.Context, id int) (*Company, error)
	Create(ctx context.Context, company *Company) error
	GetAll(ctx context.Context) ([]Company, error)
}

type CompanyRequest

type CompanyRequest struct {
	Name        string `json:"name" validate:"required"`
	YearFounded int    `json:"year_founded" validate:"required"`
}

type PgCompanyRepository

type PgCompanyRepository struct {
	// contains filtered or unexported fields
}

func NewPgCompanyRepository

func NewPgCompanyRepository(db *pgxpool.Pool) *PgCompanyRepository

func (*PgCompanyRepository) Create

func (r *PgCompanyRepository) Create(ctx context.Context, company *Company) error

func (*PgCompanyRepository) GetAll

func (r *PgCompanyRepository) GetAll(ctx context.Context) ([]Company, error)

func (*PgCompanyRepository) GetByID

func (r *PgCompanyRepository) GetByID(ctx context.Context, id int) (*Company, error)

Jump to

Keyboard shortcuts

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