domain

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: 2 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 interface {
	ID() uint
	Name() string
}

func CompanyInstance

func CompanyInstance(id uint, name string) Company

type Product

type Product interface {
	ID() uint
	Name() string
	Weight() uint
	Company() *data.LazyLoad[Company]
}

func ProductInstance

func ProductInstance(id uint, name string, weight uint, company *data.LazyLoad[Company]) Product

type ProductRepository

type ProductRepository interface {
	data.Repository[Product, uint]
	FindByCompany(ctx context.Context, company Company) ([]Product, error)
}

ProductRepository is an example of belong-to or many-to-one association and lazy loading. Refer its implementation and unit tests in infra/product_repository_test.go.

Jump to

Keyboard shortcuts

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