db

package
v0.0.0-...-1de268a Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompaniesRepo

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

CompaniesRepo allows to store and retrieve companies from the database.

func NewCompaniesRepo

func NewCompaniesRepo(db *gorm.DB) *CompaniesRepo

NewCompaniesRepo creates a new instance of the CompaniesRepo.

func (*CompaniesRepo) Create

func (c *CompaniesRepo) Create(company models.Company) (models.Company, error)

Create adds a new company to the database.

func (*CompaniesRepo) Delete

func (c *CompaniesRepo) Delete(id uint64) error

Delete deletes a company from the database.

func (*CompaniesRepo) Get

func (c *CompaniesRepo) Get(id uint64) (models.Company, error)

Get returns a single company from the database. If a company with the given id does not exist in the database this function returns a ErrCompanyNotFound error.

func (*CompaniesRepo) GetAll

GetAll returns all companies from the database.

func (*CompaniesRepo) Update

func (c *CompaniesRepo) Update(company models.Company) error

Update updates a company from the database.

Jump to

Keyboard shortcuts

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