Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AppGraph = loom.Graph[*App]( loom.Provide(NewDB), loom.Provide(NewRepository[User]), loom.Provide(NewRepository[Article]), loom.Provide(NewUserService), loom.Provide(NewArticleService), loom.Provide(NewApp), )
AppGraph wires the application.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
Users *UserService
Articles *ArticleService
}
App depends on both services.
func NewApp ¶
func NewApp(users *UserService, articles *ArticleService) *App
NewApp builds the application.
type ArticleService ¶
type ArticleService struct{ Repo *Repository[Article] }
ArticleService depends on Repository[Article] specifically.
func NewArticleService ¶
func NewArticleService(repo *Repository[Article]) *ArticleService
NewArticleService builds the article service.
type Repository ¶
Repository is generic over the entity it stores.
func NewRepository ¶
func NewRepository[T any](db *DB) *Repository[T]
NewRepository builds a repository for T.
type UserService ¶
type UserService struct{ Repo *Repository[User] }
UserService depends on Repository[User] specifically.
func NewUserService ¶
func NewUserService(repo *Repository[User]) *UserService
NewUserService builds the user service.
Click to show internal directories.
Click to hide internal directories.