-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdoc.go
More file actions
71 lines (71 loc) · 2.43 KB
/
doc.go
File metadata and controls
71 lines (71 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Package gokart provides thin wrappers around best-in-class Go packages with sensible defaults.
//
// GoKart is an opinionated service toolkit. Every component must justify its existence -
// we wrap battle-tested packages, not reinvent them.
//
// # Components
//
// Root module (github.com/dotcommander/gokart):
// - Config: viper wrapper for config files + env vars
// - State: JSON state persistence for CLI tools
// - Server: HTTP server with graceful shutdown
//
// Submodules:
// - gokart/logger: slog wrapper with JSON/text formatting
// - gokart/cli: CLI framework wrapping cobra + lipgloss
// - gokart/web: HTTP router, client, templ helpers, validator
// - gokart/postgres: pgx/v5 connection pool
// - gokart/sqlite: modernc.org/sqlite (zero CGO) with WAL mode
// - gokart/cache: go-redis/v9 with convenience methods
// - gokart/migrate: goose/v3 schema migrations
// - gokart/ai: OpenAI client factory functions
//
// # Design Principles
//
// - Thin wrappers: No business logic, just factory functions
// - Sensible defaults: Zero-config works for development and production
// - Best-in-class: Wrap proven packages, don't reinvent
// - Fight for inclusion: stdlib-sufficient things stay in stdlib
//
// # Quick Start
//
// // Logger
// log := logger.New(logger.Config{Level: "info", Format: "json"})
//
// // Config
// cfg, err := gokart.LoadConfig[AppConfig]("config.yaml")
//
// // Router (gokart/web)
// router := web.NewRouter(web.RouterConfig{Middleware: web.StandardMiddleware})
//
// // PostgreSQL (gokart/postgres)
// pool, err := postgres.Open(ctx, "postgres://localhost/mydb")
//
// // Cache (gokart/cache)
// c, err := cache.Open(ctx, "localhost:6379")
//
// // Migrations (gokart/migrate)
// migrate.Postgres(ctx, db, "migrations")
//
// # CLI Subpackage
//
// For CLI applications, use the gokart/cli subpackage which wraps cobra and lipgloss:
//
// import "github.com/dotcommander/gokart/cli"
//
// app := cli.NewApp("myapp", "1.0.0").
// WithDescription("My application").
// WithStandardFlags()
// app.Run()
//
// # Not Included
//
// GoKart intentionally excludes things where stdlib is sufficient:
//
// - Error handling: use errors.Is/As and fmt.Errorf("%w", err)
// - File operations: use os, io, filepath
// - String manipulation: use strings
// - Environment variables: viper.AutomaticEnv() handles this
//
// Domain-specific packages (AI/ML, document processing) belong in separate modules.
package gokart