service

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commands

type Commands struct {
	UserLifecycleTransition *command.UserLifecycleTransitionCommand
	BulkUserTransition      *command.BulkUserTransitionCommand
	UserInvite              *command.UserInviteCommand
	UserPasswordReset       *command.UserPasswordResetCommand
	CreateRole              *command.CreateRoleCommand
	UpdateRole              *command.UpdateRoleCommand
	DeleteRole              *command.DeleteRoleCommand
	AssignRole              *command.AssignRoleCommand
	UnassignRole            *command.UnassignRoleCommand
	LogActivity             *command.ActivityLogCommand
	ProfileUpsert           *command.ProfileUpsertCommand
	PreferenceUpsert        *command.PreferenceUpsertCommand
	PreferenceDelete        *command.PreferenceDeleteCommand
}

Commands exposes the service command handlers.

type Config

type Config struct {
	AuthRepository       types.AuthRepository
	InventoryRepository  types.UserInventoryRepository
	ActivityRepository   types.ActivityRepository
	RoleRegistry         types.RoleRegistry
	ActivitySink         types.ActivitySink
	Hooks                types.Hooks
	Clock                types.Clock
	IDGenerator          types.IDGenerator
	Logger               types.Logger
	TransitionPolicy     types.TransitionPolicy
	InviteTokenTTL       time.Duration
	ProfileRepository    types.ProfileRepository
	PreferenceRepository types.PreferenceRepository
	PreferenceResolver   PreferenceResolver
	ScopeResolver        types.ScopeResolver
	AuthorizationPolicy  types.AuthorizationPolicy
}

Config captures all required dependencies so callers can provide their own instances (bun.DB, cached repositories, hooks, etc.).

type PreferenceResolver

type PreferenceResolver interface {
	Resolve(ctx context.Context, input preferences.ResolveInput) (types.PreferenceSnapshot, error)
}

PreferenceResolver resolves scoped preferences for queries.

type Queries

type Queries struct {
	UserInventory   *query.UserInventoryQuery
	RoleList        *query.RoleListQuery
	RoleDetail      *query.RoleDetailQuery
	RoleAssignments *query.RoleAssignmentsQuery
	ActivityFeed    *query.ActivityFeedQuery
	ActivityStats   *query.ActivityStatsQuery
	ProfileDetail   *query.ProfileQuery
	Preferences     *query.PreferenceQuery
}

Queries exposes read-model helpers.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the entry point for go-users. It wires repositories, registries, hooks, and command/query facades supplied by the host application.

func New

func New(cfg Config) *Service

New constructs a Service from the supplied configuration.

func (*Service) ActivitySink

func (s *Service) ActivitySink() types.ActivitySink

ActivitySink returns the configured sink so transports can emit activity records for auxiliary workflows (e.g. CRUD controllers).

func (*Service) Commands

func (s *Service) Commands() Commands

Commands returns the command facade.

func (*Service) HealthCheck

func (s *Service) HealthCheck(ctx context.Context) error

HealthCheck exercises the registered dependencies to ensure the service can be used by upstream transports (REST/gRPC/jobs). Future implementations will ping the repositories/hooks; for now we just surface missing config.

func (*Service) Queries

func (s *Service) Queries() Queries

Queries returns the query facade.

func (*Service) Ready

func (s *Service) Ready() bool

Ready reports whether the service has the required dependencies wired in.

func (*Service) ScopeGuard

func (s *Service) ScopeGuard() scope.Guard

ScopeGuard exposes the guard instance used internally so transports can reuse the same resolver/policy combination for HTTP adapters.

Jump to

Keyboard shortcuts

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