Versions in this module Expand all Collapse all v0 deprecated v0.1.1 Oct 13, 2026 v0.1.0 Oct 13, 2026 Changes in this version + const DefaultPrefix + const DefaultTTL + const DefaultUserType + const EndExpired + const EndLeft + const InspectHistory + const InspectLeave + const InspectStart + const LogName + const MaxTTL + const OperatorRole + var ErrNotFound = fmt.Errorf("inspect: record not found: %w", model.ErrModelNotFound) + var ErrNotInspecting = fmt.Errorf("inspect: nobody is inside another account here: %w", security.ErrForbidden) + var ErrOperatorAccount = fmt.Errorf("inspect: an operator's account is not inspected: %w", security.ErrForbidden) + type Config struct + Activity *activitylog.Logger + Landing string + Prefix string + Return string + TTL time.Duration + Targets Targets + UserType string + func (c Config) Validate() error + type Flag bool + func (f *Flag) Scan(value any) error + func (f Flag) Value() (driver.Value, error) + type HistoryQuery struct + ActorID string + Page int + PerPage int + Status Status + TargetID string + type InspectPolicy struct + func (InspectPolicy) Can(ctx context.Context, s security.Subject, a security.Action, record Inspection) error + type InspectService struct + func NewInspectService(db *data.DB) *InspectService + func (s *InspectService) Find(ctx context.Context, actor security.Subject, id string) (*Inspection, error) + func (s *InspectService) History(ctx context.Context, actor security.Subject, q HistoryQuery) ([]*Inspection, int, error) + func (s *InspectService) Lapsed(ctx context.Context, current security.Subject) (bool, error) + func (s *InspectService) Leave(ctx context.Context, current security.Subject, reason string) (security.Subject, *Inspection, error) + func (s *InspectService) OpenNow(ctx context.Context, actor security.Subject) ([]*Inspection, error) + func (s *InspectService) Start(ctx context.Context, actor security.Subject, targetID string) (security.Subject, *Inspection, error) + type Inspection struct + Acting Flag + ActorID string + ClosedAt time.Time + CreatedAt time.Time + EndReason string + ExpiresAt time.Time + ID string + StartedAt time.Time + Status Status + TargetID string + TenantID string + UpdatedAt time.Time + func (i Inspection) Expired(now time.Time) bool + func (row *Inspection) Fresh(ctx context.Context, g auth.Grant, with ...string) (*Inspection, error) + func (row *Inspection) Replicate(except ...string) (*Inspection, error) + type InspectionCollection []*Inspection + func InspectionCollectionOf(rows model.Rows) InspectionCollection + func (c InspectionCollection) Contains(key any) bool + func (c InspectionCollection) Except(keys ...any) InspectionCollection + func (c InspectionCollection) Find(key any) *Inspection + func (c InspectionCollection) FindOrFail(key any) (*Inspection, error) + func (c InspectionCollection) Fresh(ctx context.Context, g auth.Grant, with ...string) (InspectionCollection, error) + func (c InspectionCollection) Load(ctx context.Context, g auth.Grant, relations ...string) error + func (c InspectionCollection) LoadCount(ctx context.Context, g auth.Grant, relations ...string) error + func (c InspectionCollection) LoadMissing(ctx context.Context, g auth.Grant, relations ...string) error + func (c InspectionCollection) ModelKeys() []any + func (c InspectionCollection) Only(keys ...any) InspectionCollection + func (c InspectionCollection) Pluck(column string) []any + func (c InspectionCollection) Rows() model.Rows + func (c InspectionCollection) ToArray() []map[string]any + func (c InspectionCollection) Unique() InspectionCollection + type InspectionQuery struct + func Inspections(db model.DB) *InspectionQuery + func (q *InspectionQuery) AddSelect(columns ...any) *InspectionQuery + func (q *InspectionQuery) Avg(ctx context.Context, g auth.Grant, column any) (any, error) + func (q *InspectionQuery) Base() *model.Builder + func (q *InspectionQuery) Chunk(ctx context.Context, g auth.Grant, count int, ...) error + func (q *InspectionQuery) Clone() *InspectionQuery + func (q *InspectionQuery) Count(ctx context.Context, g auth.Grant, columns ...any) (int64, error) + func (q *InspectionQuery) Create(ctx context.Context, g auth.Grant, attributes map[string]any) (*Inspection, error) + func (q *InspectionQuery) Cursor(ctx context.Context, g auth.Grant) iter.Seq2[*Inspection, error] + func (q *InspectionQuery) CursorPaginate(ctx context.Context, g auth.Grant, perPage int, cursor *pagination.Cursor, ...) (InspectionCollection, *pagination.CursorPage, error) + func (q *InspectionQuery) Decrement(ctx context.Context, g auth.Grant, column string, amount any, ...) (int64, error) + func (q *InspectionQuery) Delete(ctx context.Context, g auth.Grant) (int64, error) + func (q *InspectionQuery) DoesntExist(ctx context.Context, g auth.Grant) (bool, error) + func (q *InspectionQuery) DoesntHave(relation, boolean string, callback func(*query.Builder)) *InspectionQuery + func (q *InspectionQuery) Each(ctx context.Context, g auth.Grant, count int, ...) error + func (q *InspectionQuery) Exists(ctx context.Context, g auth.Grant) (bool, error) + func (q *InspectionQuery) Find(ctx context.Context, g auth.Grant, id any, columns ...any) (*Inspection, error) + func (q *InspectionQuery) FindMany(ctx context.Context, g auth.Grant, ids []any, columns ...any) (InspectionCollection, error) + func (q *InspectionQuery) FindOrFail(ctx context.Context, g auth.Grant, id any, columns ...any) (*Inspection, error) + func (q *InspectionQuery) FindOrNew(ctx context.Context, g auth.Grant, id any, columns ...any) (*Inspection, error) + func (q *InspectionQuery) First(ctx context.Context, g auth.Grant, columns ...any) (*Inspection, error) + func (q *InspectionQuery) FirstOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*Inspection, error) + func (q *InspectionQuery) FirstOrFail(ctx context.Context, g auth.Grant, columns ...any) (*Inspection, error) + func (q *InspectionQuery) FirstOrNew(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*Inspection, error) + func (q *InspectionQuery) FirstWhere(ctx context.Context, g auth.Grant, column any, args ...any) (*Inspection, error) + func (q *InspectionQuery) ForPage(page, perPage int) *InspectionQuery + func (q *InspectionQuery) ForceCreate(ctx context.Context, g auth.Grant, attributes map[string]any) (*Inspection, error) + func (q *InspectionQuery) Get(ctx context.Context, g auth.Grant, columns ...any) (InspectionCollection, error) + func (q *InspectionQuery) GroupBy(groups ...any) *InspectionQuery + func (q *InspectionQuery) Has(relation, operator string, count int, boolean string, ...) *InspectionQuery + func (q *InspectionQuery) Increment(ctx context.Context, g auth.Grant, column string, amount any, ...) (int64, error) + func (q *InspectionQuery) Insert(ctx context.Context, g auth.Grant, values ...map[string]any) (bool, error) + func (q *InspectionQuery) InsertOrIgnore(ctx context.Context, g auth.Grant, values ...map[string]any) (bool, error) + func (q *InspectionQuery) Join(table any, first any, args ...any) *InspectionQuery + func (q *InspectionQuery) Latest(column ...string) *InspectionQuery + func (q *InspectionQuery) Limit(value int) *InspectionQuery + func (q *InspectionQuery) Max(ctx context.Context, g auth.Grant, column any) (any, error) + func (q *InspectionQuery) Min(ctx context.Context, g auth.Grant, column any) (any, error) + func (q *InspectionQuery) New() (*Inspection, error) + func (q *InspectionQuery) Offset(value int) *InspectionQuery + func (q *InspectionQuery) Oldest(column ...string) *InspectionQuery + func (q *InspectionQuery) OrDoesntHave(relation string) *InspectionQuery + func (q *InspectionQuery) OrHas(relation, operator string, count int) *InspectionQuery + func (q *InspectionQuery) OrWhere(column any, args ...any) *InspectionQuery + func (q *InspectionQuery) OrWhereDoesntHave(relation string, callback func(*query.Builder)) *InspectionQuery + func (q *InspectionQuery) OrWhereHas(relation string, callback func(*query.Builder)) *InspectionQuery + func (q *InspectionQuery) OrWhereNot(column any, args ...any) *InspectionQuery + func (q *InspectionQuery) OrWhereRelation(relation string, column any, args ...any) *InspectionQuery + func (q *InspectionQuery) OrderBy(column any, direction ...string) *InspectionQuery + func (q *InspectionQuery) OrderByDesc(column any) *InspectionQuery + func (q *InspectionQuery) Paginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, ...) (InspectionCollection, *pagination.LengthAwarePage, error) + func (q *InspectionQuery) Pluck(ctx context.Context, g auth.Grant, column string) ([]any, error) + func (q *InspectionQuery) Select(columns ...any) *InspectionQuery + func (q *InspectionQuery) SelectRaw(expression string, bindings ...any) *InspectionQuery + func (q *InspectionQuery) SimplePaginate(ctx context.Context, g auth.Grant, perPage, page int, opts pagination.Options, ...) (InspectionCollection, *pagination.Page, error) + func (q *InspectionQuery) Sole(ctx context.Context, g auth.Grant, columns ...any) (*Inspection, error) + func (q *InspectionQuery) SoleValue(ctx context.Context, g auth.Grant, column string) (any, error) + func (q *InspectionQuery) Sum(ctx context.Context, g auth.Grant, column any) (any, error) + func (q *InspectionQuery) Touch(ctx context.Context, g auth.Grant, column ...string) (int64, error) + func (q *InspectionQuery) Update(ctx context.Context, g auth.Grant, values map[string]any) (int64, error) + func (q *InspectionQuery) UpdateOrCreate(ctx context.Context, g auth.Grant, attributes, values map[string]any) (*Inspection, error) + func (q *InspectionQuery) Upsert(ctx context.Context, g auth.Grant, values []map[string]any, ...) (int64, error) + func (q *InspectionQuery) Value(ctx context.Context, g auth.Grant, column string) (any, error) + func (q *InspectionQuery) ValueOrFail(ctx context.Context, g auth.Grant, column string) (any, error) + func (q *InspectionQuery) Where(column any, args ...any) *InspectionQuery + func (q *InspectionQuery) WhereBelongsTo(relationshipName string, related ...model.Entity) *InspectionQuery + func (q *InspectionQuery) WhereBetween(column any, from, to any) *InspectionQuery + func (q *InspectionQuery) WhereColumn(first any, args ...any) *InspectionQuery + func (q *InspectionQuery) WhereDoesntHave(relation string, callback func(*query.Builder)) *InspectionQuery + func (q *InspectionQuery) WhereExists(callback func(*query.Builder)) *InspectionQuery + func (q *InspectionQuery) WhereHas(relation string, callback func(*query.Builder)) *InspectionQuery + func (q *InspectionQuery) WhereHasCount(relation string, callback func(*query.Builder), operator string, count int) *InspectionQuery + func (q *InspectionQuery) WhereIn(column any, values []any) *InspectionQuery + func (q *InspectionQuery) WhereKey(id any) *InspectionQuery + func (q *InspectionQuery) WhereNot(column any, args ...any) *InspectionQuery + func (q *InspectionQuery) WhereNotExists(callback func(*query.Builder)) *InspectionQuery + func (q *InspectionQuery) WhereNotIn(column any, values []any) *InspectionQuery + func (q *InspectionQuery) WhereNotNull(columns ...any) *InspectionQuery + func (q *InspectionQuery) WhereNull(columns ...any) *InspectionQuery + func (q *InspectionQuery) WhereRelation(relation string, column any, args ...any) *InspectionQuery + func (q *InspectionQuery) With(relations ...string) *InspectionQuery + func (q *InspectionQuery) WithAvg(relation, column string) *InspectionQuery + func (q *InspectionQuery) WithCount(relations ...string) *InspectionQuery + func (q *InspectionQuery) WithExists(relation string) *InspectionQuery + func (q *InspectionQuery) WithMax(relation, column string) *InspectionQuery + func (q *InspectionQuery) WithMin(relation, column string) *InspectionQuery + func (q *InspectionQuery) WithSum(relation, column string) *InspectionQuery + func (q *InspectionQuery) Without(relations ...string) *InspectionQuery + func (q *InspectionQuery) WithoutGlobalScope(identifier string) *InspectionQuery + func (q *InspectionQuery) WithoutGlobalScopes(identifiers ...string) *InspectionQuery + type Module struct + func New(cfg Config, db *data.DB, sessions *security.SessionStore) (*Module, error) + func (m *Module) Guard() func(stdhttp.Handler) stdhttp.Handler + func (m *Module) Migrations() []foundation.Migration + func (m *Module) Name() string + func (m *Module) Routes(r *fhttp.Router) + func (m *Module) Service() *InspectService + type Status string + const Closed + const Open + type Targets interface + Target func(ctx context.Context, tenant, userID string) (security.Subject, error) + type TargetsFunc func(ctx context.Context, tenant, userID string) (security.Subject, error) + func (f TargetsFunc) Target(ctx context.Context, tenant, userID string) (security.Subject, error)