Documentation ¶
Index ¶
- type CompanyStorage
- func (s *CompanyStorage) AddCompany(ctx context.Context, company entities.Company) (entities.Company, error)
- func (s *CompanyStorage) DeleteCompany(ctx context.Context, companyId int64) (err error)
- func (s *CompanyStorage) GetCompanyByOwnerTelegramId(ctx context.Context, ownerId int64) (entities.Company, error)
- func (s *CompanyStorage) UpdateToken(ctx context.Context, companyId int64, token string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompanyStorage ¶
type CompanyStorage struct {
// contains filtered or unexported fields
}
CompanyStorage is a storage implementation for companies using PostgreSQL.
func New ¶
func New(db *sqlx.DB) *CompanyStorage
New creates a new instance of CompanyStorage with the given database connection.
func (*CompanyStorage) AddCompany ¶
func (s *CompanyStorage) AddCompany(ctx context.Context, company entities.Company) (entities.Company, error)
AddCompany adds a new company to the database and returns the newly created company.
func (*CompanyStorage) DeleteCompany ¶
func (s *CompanyStorage) DeleteCompany(ctx context.Context, companyId int64) (err error)
DeleteCompany deletes a company by its ID.
func (*CompanyStorage) GetCompanyByOwnerTelegramId ¶
func (s *CompanyStorage) GetCompanyByOwnerTelegramId(ctx context.Context, ownerId int64) (entities.Company, error)
GetCompanyByOwnerTelegramId retrieves a company by the owner's Telegram ID. If the company is not found, ErrNotFound is returned.
func (*CompanyStorage) UpdateToken ¶
UpdateToken updates the company's token.
Click to show internal directories.
Click to hide internal directories.