Packages

Package Overview

bkgo ships 17 independent packages. Import only what you need — every package has no dependency on the others except through the contract interfaces.


contract
portsinterfaces

Core interfaces (ports): ORM, Database, Rows, Row, Tx, Transactional, Cache, Storage, Token, Claims.

config
envenabled-flags

Load .env into typed Config. *_ENABLED flags for Postgres/Redis/MinIO/JWT. Validates only enabled adapters. Builds Postgres DSN.

pkg/utils
helpersgeneric

Generic helpers: Coalesce and Unique. Domain-independent — scaffold also drops a copy into your project's pkg/utils.

adapter/gormdefault
gormpostgres

GORM v2 PostgreSQL adapter. Implements contract.ORM. Default database adapter for all generated modules.

adapter/postgres
postgrespgx

Raw SQL adapter. pgx v5 connection pool. Implements contract.Database and contract.Transactional.

adapter/redis
rediscache

go-redis v9 client. Implements contract.Cache. Wire when REDIS_ENABLED=true.

adapter/minio
miniostorage

MinIO object storage. Auto-creates buckets on startup. Wire when MINIO_ENABLED=true.

adapter/jwt
jwtauth

golang-jwt v5, HMAC-SHA256. Sign/Verify reject empty secrets. Wire when JWT_ENABLED=true.

middleware
fiberauthrbac

Fiber middleware: JWT auth, RBAC role checking, configurable CORS with preflight support.

errs
errorshttp

AppError type with HTTP status + error code. Sentinels: NotFound, BadRequest, Unauthorized, Conflict, etc.

response
jsonapi

Standard JSON response envelope: Success, SuccessMessage, Paginated, Error. Consistent API responses.

i18n
i18nlocalization

Thread-safe locale registry. Parse Accept-Language header. Built-in EN, LO (Lao), TH, ZH. Custom locales.

validator
validationinput

Struct validation via go-playground/validator. Human-readable field error messages. Custom rule registration.

hash
bcryptsecurity

bcrypt password hashing and verification via golang.org/x/crypto.

paginate
pagination

Offset pagination params. Normalize() clamps Page/Limit. Offset() computes DB offset without mutation.

logger
sloglogging

slog-based logger factory. Development() for text output, Production() for JSON. Zero external deps.

mock
testingmocks

Function-override test doubles for Database, Cache, Storage, Token, Tx, TransactionalDB. No mock frameworks.