Skip to main content

Generated API inventory

Generated from github.com/datakaveri/dx-common-go at commit 108bf9fa3fef (source commit date: 2026-08-05). Do not edit this file by hand.

platform/bootstrap

func Run[C config.Configurer](spec Spec[C])
type App[C config.Configurer] struct{ ... }
type Dep[T any] struct{ ... }
func Degrade[T any](c T) *Dep[T]
func Required[T any](c T) *Dep[T]
type Deps struct{ ... }
type MigrationSpec struct{ ... }
func Migrations(fsys fs.FS, dir, table string) *MigrationSpec
type Spec[C config.Configurer] struct{ ... }

platform/cache

var ErrLockHeld = errors.New("cache: lock held by another holder")
var ErrMiss = errors.New("cache: miss")
func GetOrLoad[T any](ctx context.Context, s Scope, key string, ...) (T, error)
func GetOrLoadAhead[T any](ctx context.Context, s Scope, key string, refreshAfter time.Duration, ...) (T, error)
func Invalidating(ctx context.Context, s Scope, key string, fn func(context.Context) error) error
type Cache interface{ ... }
func New(s Store, opts ...Option) Cache
type Memory struct{ ... }
func NewMemory() *Memory
type Option func(*scope)
func WithDefaultTTL(d time.Duration) Option
func WithPrefix(p string) Option
type Scope interface{ ... }
type Store interface{ ... }

platform/cache/redis

type Config struct{ ... }
type Store struct{ ... }
func NewStore(c *goredis.Client) *Store
func Open(ctx context.Context, cfg Config) (*Store, error)

platform/config

var PlaceholderSecrets = []string{ ... }
func CheckSecret(name, value string) error
func Load[T any](opts Options) (*T, error)
func PlatformDefaults() map[string]any
type Base struct{ ... }
type Configurer interface{ ... }
type InternalAuth struct{ ... }
type OpenAPI struct{ ... }
type Options struct{ ... }
type Server struct{ ... }
type Validator interface{ ... }

platform/database/sql

var ErrLockHeld = errors.Conflict("advisory lock is held by another session")
func Collect[T any](rows Rows, err error) ([]T, error)
func IsRetryable(err error) bool
func MapError(err error) error
func One[T any](rows Rows, err error) (T, error)
func SQL[T any](ctx context.Context, q Querier, sql string, args ...any) ([]T, error)
func SQLOne[T any](ctx context.Context, q Querier, sql string, args ...any) (T, error)
func Where(preds []Pred, start int) (string, []any)
type Column string
type Config struct{ ... }
type DB interface{ ... }
func Open(ctx context.Context, cfg Config, opts ...Option) (DB, error)
type IsolationLevel string
const ReadCommitted IsolationLevel = "read committed" ...
type Manager interface{ ... }
func NewManager(db DB) Manager
type Option func(*openOptions)
func WithLogger(l *zap.Logger) Option
func WithTracer(t pgx.QueryTracer) Option
type Order struct{ ... }
func Asc(c Column) Order
func Desc(c Column) Order
type Pred struct{ ... }
func And(ps ...Pred) Pred
func Between(c Column, lo, hi any) Pred
func Eq(c Column, v any) Pred
func Gt(c Column, v any) Pred
func Gte(c Column, v any) Pred
func ILike(c Column, pattern string) Pred
func In[T any](c Column, vs []T) Pred
func Like(c Column, pattern string) Pred
func Lt(c Column, v any) Pred
func Lte(c Column, v any) Pred
func Ne(c Column, v any) Pred
func Not(p Pred) Pred
func NotIn[T any](c Column, vs []T) Pred
func NotNull(c Column) Pred
func Null(c Column) Pred
func Or(ps ...Pred) Pred
func Raw(fragment string, values ...any) Pred
type Querier interface{ ... }
func Conn(ctx context.Context, db DB) Querier
type Query[T any] struct{ ... }
type Repo[T any] struct{ ... }
func NewRepo[T any](db DB, opts ...RepoOption[T]) *Repo[T]
type RepoOption[T any] func(*Repo[T])
func WithID[T any](c Column) RepoOption[T]
func WithSoftDelete[T any](c Column, deleted, active any) RepoOption[T]
func WithTable[T any](name string) RepoOption[T]
type Row interface{ ... }
type Rows interface{ ... }
type Sortable map[string]Column
type Stats struct{ ... }
type Tx interface{ ... }
func TxFrom(ctx context.Context) (Tx, bool)
type TxOption func(*txConfig)
func Deferrable() TxOption
func Isolation(l IsolationLevel) TxOption
func ReadOnly() TxOption

platform/database/sql/pgx

func Pool(db dxsql.DB) *pgxpool.Pool
func Tracer(t pgx.QueryTracer) dxsql.Option

platform/errors

var ErrValidation = &Error{ ... } ...
func Classified(err error) bool
func Details(err error) []string
func HTTPStatusOf(err error) int
func IsConflict(err error) bool
func IsForbidden(err error) bool
func IsInternal(err error) bool
func IsNotFound(err error) bool
func IsRetryable(err error) bool
func IsUnauthorized(err error) bool
func IsValidation(err error) bool
func Message(err error) string
func TitleOf(err error) string
func URNOf(err error) string
type Code string
const CodeValidation Code = "ERR_VALIDATION" ...
func CodeOf(err error) Code
type Error struct{ ... }
func BadGateway(message string, details ...string) *Error
func Conflict(message string, details ...string) *Error
func Database(message string, details ...string) *Error
func Expired(message string, details ...string) *Error
func Forbidden(message string, details ...string) *Error
func Internal(message string, details ...string) *Error
func MethodNotAllowed(message string, details ...string) *Error
func New(code Code, message string, details ...string) *Error
func NotFound(message string, details ...string) *Error
func ServiceUnavailable(message string, details ...string) *Error
func TooManyRequests(message string, details ...string) *Error
func Unauthorized(message string, details ...string) *Error
func Validation(message string, details ...string) *Error
func Wrap(err error, code Code, message string) *Error

platform/events

var ErrDrop = errors.New("events: drop this message")
func Publish[T any](ctx context.Context, o *Outbox, t Topic[T], payload T, opts ...Option) error
type Bus interface{ ... }
type Dispatcher struct{ ... }
func NewDispatcher(o *Outbox, b Bus, batch int, log Logger) *Dispatcher
type Event struct{ ... }
type Handler func(ctx context.Context, e Event) error
type Logger interface{ ... }
type Memory struct{ ... }
func NewMemory() *Memory
type Option func(*Event)
func WithCorrelationID(id string) Option
func WithID(id string) Option
func WithOccurredAt(t time.Time) Option
type Outbox struct{ ... }
func NewOutbox(db dxsql.DB, table string) *Outbox
type Topic[T any] struct{ ... }
func NewTopic[T any](name string) Topic[T]

platform/events/amqp

type Bus struct{ ... }
func Open(cfg Config) (*Bus, error)
type Config struct{ ... }

platform/grpc

func CodeOf(err error) codes.Code
func FromStatus(err error) error
func Status(err error) error

platform/http

const DefaultTimeout = 30 * time.Second
const RequestIDHeader = "X-Request-ID"
func Handle[Req, Res any](h Handler[Req, Res], opts ...Option) http.HandlerFunc
func HandleOptional[Req, Res any](h Handler[Req, Res], opts ...Option) http.HandlerFunc
func HandleRaw[Req any](h func(context.Context, Req) (Response, error), opts ...Option) http.HandlerFunc
func HandleVoid[Req any](h func(context.Context, Req) error, opts ...Option) http.HandlerFunc
func IsClientGone(err error) bool
func NewRouter(spec RouterSpec, sets ...RouteSet) http.Handler
func PathValue(r *http.Request, name string) string
func RequestIDFrom(ctx context.Context) string
func RespondProblem(w http.ResponseWriter, p Problem)
func SetPathValueFunc(f PathValueFunc)
type Accepted[T any] struct{ ... }
type Actor struct{ ... }
type AuthSpec struct{ ... }
type Binder interface{ ... }
type CORSConfig struct{ ... }
func DefaultCORS() CORSConfig
type Created[T any] struct{ ... }
type ErrorMapper func(error) (Problem, bool)
type Handler[Req, Res any] func(ctx context.Context, req Req) (Res, error)
type None struct{}
type Option func(*options)
func WithLogger(l *zap.Logger) Option
func WithMappers(m ...ErrorMapper) Option
func WithMessage(title, detail string) Option
func WithURNs(s URNSpace) Option
type OptionalActor struct{ ... }
type PathValueFunc func(*http.Request, string) string
type Problem struct{ ... }
func ToProblem(err error, mappers []ErrorMapper) Problem
type Response interface{ ... }
func Blob(contentType string, size int64, body io.ReadCloser) Response
func JSON(status int, v any) Response
func NotModified(etag string) Response
func Redirect(status int, url string) Response
type ResponseFunc func(http.ResponseWriter, *http.Request) error
type Route struct{ ... }
func DELETE(path string, h http.HandlerFunc, opts ...RouteOption) Route
func GET(path string, h http.HandlerFunc, opts ...RouteOption) Route
func PATCH(path string, h http.HandlerFunc, opts ...RouteOption) Route
func POST(path string, h http.HandlerFunc, opts ...RouteOption) Route
func PUT(path string, h http.HandlerFunc, opts ...RouteOption) Route
type RouteOption func(*Route)
func OpID(id string) RouteOption
func Optional() RouteOption
func Public() RouteOption
func Roles(roles ...string) RouteOption
func Streaming() RouteOption
type RouteSet struct{ ... }
func Routes(prefix string, routes ...Route) RouteSet
type RouterSpec struct{ ... }
type URNSpace string

platform/http/middleware

func Resolve(cfg AuthConfig) func(http.Handler) http.Handler
func SubjectFrom(r *http.Request) (identity.Subject, bool)
type AuthConfig struct{ ... }
type Mode int
const Required Mode = iota ...

platform/observability/health

const DefaultTimeout = 2 * time.Second
type Checker interface{ ... }
type CheckerFunc func(ctx context.Context) error
type Registry struct{ ... }
func New() *Registry
type Report struct{ ... }
type Result struct{ ... }
type Status string
const StatusUp Status = "up" ...

platform/paging

const DefaultPage = 1 ...
const ParamPage = "page" ...
const MaxSortKeys = 3
type Direction string
const Asc Direction = "asc" ...
type Info struct{ ... }
func InfoFor(r Request, totalCount int64) Info
func NewInfo(page, size int, totalCount int64) Info
type Page[T any] struct{ ... }
func Empty[T any](r Request) Page[T]
func MapPage[A, B any](p Page[A], fn func(A) B) Page[B]
func NewPage[T any](items []T, r Request, totalCount int64) Page[T]
type ParamError struct{ ... }
type Params struct{ ... }
func Parse(r *http.Request) (Params, error)
func ParseValues(q url.Values) (Params, error)
func Strict(r *http.Request, known ...string) (Params, error)
type Request struct{ ... }
func NewRequest(page, size int) Request
type SortError struct{ ... }
type SortKey struct{ ... }
func ParseSort(raw string) ([]SortKey, error)

platform/security/identity

var ErrNoSubject = errors.New("identity: no verified subject on the request")
func With(ctx context.Context, s Subject) context.Context
type Delegation struct{ ... }
type Kind string
const KindAgent Kind = "agent" ...
type Scope struct{ ... }
type Subject struct{ ... }
func From(ctx context.Context) (Subject, bool)
func MustFrom(ctx context.Context) Subject
func Require(ctx context.Context) (Subject, error)