company

package
v0.0.0-...-bae6b6e Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

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

func (s *CompanyStorage) UpdateToken(ctx context.Context, companyId int64, token string) error

UpdateToken updates the company's token.

Jump to

Keyboard shortcuts

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