iface

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

AppGraph wires *userStore into UserStore via loom.As.

Functions

func NewUserStore

func NewUserStore(db *DB) *userStore

NewUserStore returns the concrete store; note it is unexported, so only the interface escapes the package.

Types

type App

type App struct {
	Service *UserService
}

App is the assembled application.

func InitApp

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

InitApp builds *App from the graph declared by AppGraph.

func NewApp

func NewApp(svc *UserService) *App

NewApp builds the application.

type DB

type DB struct {
	Users map[int64]*User
}

DB is a placeholder database handle.

func NewDB

func NewDB() *DB

NewDB opens the database and seeds one user.

type User

type User struct {
	ID   int64
	Name string
}

User is a domain entity.

type UserService

type UserService struct {
	Store UserStore
}

UserService depends on the interface, not the implementation.

func NewUserService

func NewUserService(store UserStore) *UserService

NewUserService builds the service.

type UserStore

type UserStore interface {
	Find(ctx context.Context, id int64) (*User, error)
}

UserStore is the persistence boundary the service depends on.

Jump to

Keyboard shortcuts

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