examples/

directory
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT

README

lagodev examples

Pick the one that matches your stack — each runs standalone with go mod tidy && go run ..

Folder What it shows
basic/ The 30-line tour: connection → migrations → ORM → query
blog/ Full showcase — 3 models, FK, factories, seeders, service
gin/ Gin v1 server wrapping a framework-agnostic service
fiber/ Fiber v2 — identical service, swapped HTTP layer
echo/ Echo v4 — same
chi/ Chi v5 — Go-native routing on top of net/http
microservice/ A queue-style worker with LockForUpdate + tx
grpc/ A bare-bones gRPC service that shares the ORM with HTTP

The pattern

Every example follows the same shape:

1. Define models (embed orm.Model)
2. Register migrations in init()
3. Apply migrations at startup
4. Build a *Service struct that takes a *database.Connection
5. Wrap the service in framework-specific handlers

The *Service layer is the integration point — it returns plain Go values and errors. That's why swapping Gin → Fiber → Echo means changing only the HTTP wiring, never the business logic.

See also

Directories

Path Synopsis
Example: end-to-end usage of lagodev with an in-memory SQLite database.
Example: end-to-end usage of lagodev with an in-memory SQLite database.
Example: a microservice-style worker that reads jobs from a queue table.
Example: a microservice-style worker that reads jobs from a queue table.
Example: secure-by-default lagodev HTTP service.
Example: secure-by-default lagodev HTTP service.

Jump to

Keyboard shortcuts

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