commongo

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package commongo embeds the per-language seed packages dropped into every new maestro project under <project>/common/go/. The Go seed is the source-of-truth for the common/go starter: real Go files so gopls validates them in author-mode and so future presets can import them as `<usermodule>/common/go/<pkg>` and have the import resolve under the maestro repo too.

The empty `_` rooted at this directory ships every file under here into FS — adding a new starter package is just `mkdir <name> && go build`, no other code change.

Index

Constants

View Source
const ImportRoot = "github.com/Zagforge-Org/maestro/internal/scaffold/commongo"

ImportRoot is the maestro-module import path prefix every shared package under this tree lives at. Cross-package imports are written against it so they resolve in maestro's author-mode; when the tree is copied into a user project, the init walker and preset apply rewrite it to the project's common/go module path. Single source of truth for the prefix, so a rename of maestro only touches this line.

Variables

View Source
var Capabilities = map[string]bool{
	"jwtx":         true,
	"proxyx":       true,
	"ratelimitx":   true,
	"internalauth": true,
}

Capabilities are the optional capability libraries that are NOT shipped at project init. They land in common/go only when a preset that depends on one is applied (preset.Manifest.CommonGo drives the selection). This keeps a plain project's common/go module free of dependencies it never uses — e.g. jwtx's golang-jwt — while still letting a preset deliver a reusable, hand-composable building block on apply.

FS is the embedded starter tree. Top-level entries are package directories (logger, ids, errs, …); the project-init writer walks this and copies every non-capability file into <project>/common/go/.

Functions

func IsCapability

func IsCapability(pkg string) bool

IsCapability reports whether the top-level package directory pkg is an opt-in capability lib (so the init walker can skip it).

func RewriteImportRoot

func RewriteImportRoot(content, module string) string

RewriteImportRoot rewrites ImportRoot in content to module, the destination project's common/go module path, so a copied file's sibling imports point at the project rather than maestro. No-op when module is empty.

Types

This section is empty.

Directories

Path Synopsis
Package envx contains small environment-variable helpers used by service main packages.
Package envx contains small environment-variable helpers used by service main packages.
Package errs defines the project's typed error envelope.
Package errs defines the project's typed error envelope.
Bearer-token authentication middleware for Gin-based services.
Bearer-token authentication middleware for Gin-based services.
Package grpcx wraps the gRPC-server boilerplate every gRPC service main would otherwise duplicate: bind a listener, Serve in a goroutine, wait for ctx to cancel, then GracefulStop.
Package grpcx wraps the gRPC-server boilerplate every gRPC service main would otherwise duplicate: bind a listener, Serve in a goroutine, wait for ctx to cancel, then GracefulStop.
Package httpx wraps the HTTP-server boilerplate every service main would otherwise duplicate: build an http.Server, run ListenAndServe in a goroutine, wait for ctx to cancel, then Shutdown within a deadline.
Package httpx wraps the HTTP-server boilerplate every service main would otherwise duplicate: build an http.Server, run ListenAndServe in a goroutine, wait for ctx to cancel, then Shutdown within a deadline.
Package identity reads the trusted caller an api-gateway injects, so a service behind the gateway can know who's calling without re-validating a token or importing any auth machinery.
Package identity reads the trusted caller an api-gateway injects, so a service behind the gateway can know who's calling without re-validating a token or importing any auth machinery.
Package ids hosts typed wrappers for cross-service entity IDs.
Package ids hosts typed wrappers for cross-service entity IDs.
Package internalauth is the gateway <-> service identity assertion: the gateway mints a short-lived ES256 token asserting the verified caller, and services verify it with the gateway's PUBLIC key before trusting that identity.
Package internalauth is the gateway <-> service identity assertion: the gateway mints a short-lived ES256 token asserting the verified caller, and services verify it with the gateway's PUBLIC key before trusting that identity.
Package jwtx is the shared token contract for an asymmetric JWT scheme.
Package jwtx is the shared token contract for an asymmetric JWT scheme.
Package logger builds the project's standard zap logger.
Package logger builds the project's standard zap logger.
Env-driven factory for the mailer.
Env-driven factory for the mailer.
Package proxyx is a small reverse-proxy engine for an edge service: it builds an httputil.ReverseProxy to a single upstream that strips a leading API-version segment, forwards X-Forwarded-* headers, and maps upstream failures to clean gateway status codes.
Package proxyx is a small reverse-proxy engine for an edge service: it builds an httputil.ReverseProxy to a single upstream that strips a leading API-version segment, forwards X-Forwarded-* headers, and maps upstream failures to clean gateway status codes.
Package ratelimitx is a distributed request limiter built on a Redis token bucket, with a circuit-breaker-guarded in-memory fallback.
Package ratelimitx is a distributed request limiter built on a Redis token bucket, with a circuit-breaker-guarded in-memory fallback.
Package rdb is the shared Redis connector: it parses a REDIS_URL into a go-redis client.
Package rdb is the shared Redis connector: it parses a REDIS_URL into a go-redis client.

Jump to

Keyboard shortcuts

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