infra

package
v0.0.0-...-0dc4125 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	data.LazyLoader `gorm:"-"`
	ID              uint
	Name            string
	ParentID        *uint
	Parent          *Category `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
}

func (Category) From

func (c Category) From(m domain.Category) any

func (Category) To

func (c Category) To() domain.Category

type CategoryRepository

type CategoryRepository struct {
	data.Repository[domain.Category, uint]
}

func NewCategoryRepository

func NewCategoryRepository(repository data.Repository[domain.Category, uint]) *CategoryRepository

type Company

type Company struct {
	ID   uint   `gorm:"primaryKey;column:id"`
	Name string `gorm:"column:name"`
}

func (Company) From

func (c Company) From(m domain.Company) any

func (Company) To

func (c Company) To() domain.Company

type CompanyRepository

type CompanyRepository struct {
	data.Repository[domain.Company, uint]
}

func NewCompanyRepository

func NewCompanyRepository(repository data.Repository[domain.Company, uint]) *CompanyRepository

type CreditCard

type CreditCard struct {
	ID         uint
	Number     string
	EmployeeID uint
}

func (CreditCard) From

func (c CreditCard) From(m domain.CreditCard) any

func (CreditCard) To

func (c CreditCard) To() domain.CreditCard

type Department

type Department struct {
	data.LazyLoader `gorm:"-"`
	ID              uint   `gorm:"primaryKey;column:id"`
	Name            string `gorm:"column:name"`
	CompanyID       uint
	Company         Company `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	UpperID         *uint
	Upper           *Department `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	ManagerID       uint
	Manager         Employee `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
}

func (Department) From

func (d Department) From(m domain.Department) any

func (Department) To

func (d Department) To() domain.Department

type DepartmentRepository

type DepartmentRepository struct {
	data.Repository[domain.Department, uint]
	// contains filtered or unexported fields
}

func NewDepartmentRepository

func NewDepartmentRepository(repository data.Repository[domain.Department, uint], findByUpperRepository data.FindByRepository[domain.Department, domain.Department]) *DepartmentRepository

func (*DepartmentRepository) FindByUpper

func (e *DepartmentRepository) FindByUpper(ctx context.Context, upper domain.Department) ([]domain.Department, error)

type Employee

type Employee struct {
	data.LazyLoader `gorm:"-"`
	ID              uint   `gorm:"primaryKey;column:id"`
	Name            string `gorm:"column:name"`
	CompanyID       uint
	Company         Company      `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	Manages         []Product    `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	CreditCard      CreditCard   `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" fetch:"eager"`
	Departments     []Department `gorm:"many2many:employee_departments;" fetch:"lazy"`
	Languages       []Language   `gorm:"many2many:employee_languages;" fetch:"lazy"`
}

func (Employee) From

func (e Employee) From(m domain.Employee) any

func (Employee) To

func (e Employee) To() domain.Employee

type EmployeeRepository

type EmployeeRepository struct {
	data.Repository[domain.Employee, uint]
	// contains filtered or unexported fields
}

func NewEmployeeRepository

func NewEmployeeRepository(
	repository data.Repository[domain.Employee, uint],
	findByCompanyRepository data.FindByRepository[domain.Employee, domain.Company],
	findByDepartmentRepository data.FindByRepository[domain.Employee, domain.Department],
) *EmployeeRepository

func (*EmployeeRepository) FindByCompany

func (e *EmployeeRepository) FindByCompany(ctx context.Context, company domain.Company) ([]domain.Employee, error)

func (*EmployeeRepository) FindByDepartment

func (e *EmployeeRepository) FindByDepartment(ctx context.Context, department domain.Department) ([]domain.Employee, error)

type Language

type Language struct {
	ID   string
	Name string
}

func (Language) From

func (l Language) From(m domain.Language) any

func (Language) To

func (l Language) To() domain.Language

type LanguageRepository

type LanguageRepository struct {
	data.Repository[Language, string]
}

func NewLanguageRepository

func NewLanguageRepository(repository data.Repository[Language, string]) *LanguageRepository

type Product

type Product struct {
	data.LazyLoader `gorm:"-"`
	ID              uint   `gorm:"primaryKey;column:id"`
	Name            string `gorm:"column:name"`
	CompanyID       uint
	Company         Company `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	CategoryID      uint
	Category        Category `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	EmployeeID      uint
}

func (Product) From

func (p Product) From(m domain.Product) any

func (Product) To

func (p Product) To() domain.Product

type ProductRepository

type ProductRepository struct {
	data.Repository[domain.Product, uint]
	// contains filtered or unexported fields
}

func NewProductRepository

func NewProductRepository(
	repository data.Repository[domain.Product, uint],
	companyBelongToRepository data.FindByRepository[domain.Product, domain.Company],
	categoryBelongToRepository data.FindByRepository[domain.Product, domain.Category],
) *ProductRepository

func (*ProductRepository) FindByCategory

func (p *ProductRepository) FindByCategory(ctx context.Context, category domain.Category) ([]domain.Product, error)

func (*ProductRepository) FindByCompany

func (p *ProductRepository) FindByCompany(ctx context.Context, company domain.Company) ([]domain.Product, error)

Jump to

Keyboard shortcuts

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