users

package
v0.0.0-...-9358009 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package users is the public facade for the users domain. Register is the only symbol other packages may call — everything else lives under users/internal and is compiler-sealed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProvideResolver

func ProvideResolver(issuer domain.SessionIssuer) auth.Resolver

ProvideResolver adapts the session issuer to gonext's published auth.Resolver contract.

This provider is the Auth Provider Abstraction: pointing wire at a different auth.Resolver — a Clerk or Supabase adapter the project simply `go get`s — swaps the identity provider without touching the middleware, the contract, or any handler that reads an identity.

func ProvideSessionIssuer

func ProvideSessionIssuer(db *bun.DB) domain.SessionIssuer

ProvideSessionIssuer builds the Postgres-backed session issuer.

func Register

func Register(api huma.API, db *bun.DB, cfg config.Config, logger *slog.Logger, issuer domain.SessionIssuer) error

Register wires up the users domain's dependencies and registers its HTTP endpoints on api, backed by db. cfg supplies the environment that gates the domain's production-only behaviour, logger backs the default no-op notifier, and issuer is passed in rather than built here so the process has exactly one session issuer — the auth middleware must resolve against the same one that issues.

Types

type Registered

type Registered struct{}

Registered is a marker type with no fields: its only purpose is to give wire something to depend on, so it sequences Register's side-effecting call into the generated injector instead of main.go calling it by hand.

func ProvideRegistration

func ProvideRegistration(api huma.API, db *bun.DB, cfg config.Config, logger *slog.Logger, issuer domain.SessionIssuer) (Registered, error)

ProvideRegistration calls Register and returns a marker wire can depend on to guarantee the registration ran.

Directories

Path Synopsis
Package domain holds the users domain's public entities, value objects, domain errors, and ports.
Package domain holds the users domain's public entities, value objects, domain errors, and ports.
internal
application
Package application holds the users domain's use cases.
Package application holds the users domain's use cases.
idgen
Package idgen mints the users domain's random identifiers: user ids, one-shot token values, and session tokens.
Package idgen mints the users domain's random identifiers: user ids, one-shot token values, and session tokens.
infrastructure/auth
Package auth adapts the users track's session issuer to gonext's published auth.Resolver contract — the default identity provider, swapped by providing a different auth.Resolver in wire.go.
Package auth adapts the users track's session issuer to gonext's published auth.Resolver contract — the default identity provider, swapped by providing a different auth.Resolver in wire.go.
infrastructure/memory
Package memory provides in-memory adapters for the users domain's ports, so application-layer use cases can be tested without a database.
Package memory provides in-memory adapters for the users domain's ports, so application-layer use cases can be tested without a database.
infrastructure/notify
Package notify provides Core's default domain.Notifier: one that logs instead of sending mail.
Package notify provides Core's default domain.Notifier: one that logs instead of sending mail.
infrastructure/postgres
Package postgres provides the users domain's Postgres-backed adapters for its repository, session, and transaction ports.
Package postgres provides the users domain's Postgres-backed adapters for its repository, session, and transaction ports.
presentation
Package presentation exposes the users domain's HTTP operations on a shared huma.API, translating domain errors into HTTP status codes and owning the session cookie mechanics.
Package presentation exposes the users domain's HTTP operations on a shared huma.API, translating domain errors into HTTP status codes and owning the session cookie mechanics.

Jump to

Keyboard shortcuts

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