generic

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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 InitApp

func InitApp() (*App, *loom.Lifecycle, error)

InitApp builds *App from the graph declared by AppGraph.

func NewApp

func NewApp(users *UserService, articles *ArticleService) *App

NewApp builds the application.

type Article

type Article struct{ Title string }

Article is a domain entity.

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 DB

type DB struct {
	Opens int
}

DB is shared by both repositories.

func NewDB

func NewDB() *DB

NewDB opens a database.

type Repository

type Repository[T any] struct {
	DB *DB
}

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 User

type User struct{ Name string }

User is a domain entity.

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.

Jump to

Keyboard shortcuts

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