02 · app/controllers
Controllers convert and call
A handler converts HTTP into model values, calls one method on a store interface declared next to it holding only what that controller needs, and converts the result back. *gin.Context never leaves this folder.
// app/controllers/posts_controller.go
type postsStore interface {
CreatePost(ctx context.Context, p models.Post) (models.Post, error)
GetPost(ctx context.Context, id string) (models.Post, error)
ListPosts(ctx context.Context, limit int32) ([]models.Post, error)
UpdatePost(ctx context.Context, p models.Post) (models.Post, error)
DeletePost(ctx context.Context, id string) error
}