MCPcopy Index your code
hub / github.com/katzien/go-structure-examples

github.com/katzien/go-structure-examples @v.10 sqlite

repository ↗ · DeepWiki ↗ · release v.10 ↗
302 symbols 575 edges 82 files 215 documented · 71%
README

Examples for my talk on structuring Go apps.

Links to video and slides:

2018-09-28 GoWayFest 2.0 video | slides

2018-09-19 London Gophers video | slides

2018-08-28 GopherCon 2018 video | slides

Older versions of this talk:

2018-06-02 GopherCon EU video | slides

2018-06-02 GopherCon UK video | slides

How to run

Not all of these examples will compile. Only the flat, domain, domain-hex and domain-hex-actor will compile. For more information about why that is, please refer to the talk.

Extension points exported contracts — how you extend this code

Storage (Interface)
Storage defines the functionality of a data store for the beer service. [4 implementers]
modular/storage/storage.go
Storage (Interface)
Storage represents all possible actions available to deal with data [4 implementers]
flat/storage.go
Storage (Interface)
Storage represents all possible actions available to deal with data [4 implementers]
layered/models/storage.go
Repository (Interface)
Repository provides access to the review storage.
domain-hex/pkg/reviewing/service.go
Repository (Interface)
Repository provides access to the review storage.
domain-hex-actor/pkg/reviewing/service.go
Repository (Interface)
Repository provides access to the beer storage.
domain/beers/beer.go
Service (Interface)
Service provides review adding operations
domain/reviewing/service.go
Service (Interface)
Service provides beer or review listing operations
domain/listing/service.go

Core symbols most depended-on inside this repo

SaveBeer
called by 11
layered/models/storage.go
SaveReview
called by 7
layered/models/storage.go
AddBeer
called by 6
domain-hex-actor/pkg/adding/service.go
AddReview
called by 4
domain-hex-actor/pkg/reviewing/service.go
GetBeer
called by 4
domain-hex-actor/pkg/listing/service.go
GetAllBeers
called by 4
domain-hex-actor/pkg/listing/service.go
Add
called by 4
domain/reviews/review.go
AddBeerReview
called by 3
domain/reviewing/service.go

Shape

Method 143
Function 78
Struct 48
Interface 21
TypeAlias 10
FuncType 2

Languages

Go100%

Modules by API surface

domain-hex/pkg/listing/service.go13 symbols
domain-hex-actor/pkg/listing/service.go13 symbols
domain-hex-actor/pkg/adding/service.go12 symbols
domain-hex-actor/pkg/reviewing/service.go11 symbols
domain-hex/pkg/adding/service.go10 symbols
modular/storage/storage.go9 symbols
layered/models/storage.go9 symbols
domain/storage/json.go9 symbols
domain/listing/service.go9 symbols
domain-hex/pkg/reviewing/service.go9 symbols
modular/storage/json.go8 symbols
layered/storage/json.go8 symbols

For agents

$ claude mcp add go-structure-examples \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact