groups

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: AGPL-3.0 Imports: 24 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README


type: index status: Accepted updated: 2026-11-21

StuHelper Groups

groups 管理群配置、申请和成员资格、群规则、消息留存、举报、订阅及机器人动作。管理操作通过 platform 校验学校、群和操作能力。QQ 绑定、资格和名片字段由各来源模块提供当前事实。

OpenAPI 版本为 0.4.0,HTTP 接口使用 /api/v1/groups 前缀。Go 和 TypeScript SDK 位于 sdk。群内事实的后台账号查询使用独立 Go 服务。

  • 装配指南涵盖依赖、数据库、事件、Koishi 和 HTTP 接口。
  • 账号查询规格列出可查字段、权限范围和分页规则。
  • 实施状态记录当前实现、测试范围和待验证事项。
make setup
bash scripts/check-with-postgres.sh

make setup 安装锁定的依赖和 Lefthook。工具链版本见 .go-version、.node-version 和 package.json,正式 Go 构建设置 GOWORK=off。

检查脚本启动仅监听独立 Unix socket 的 PostgreSQL 18,完成后清理本次数据库目录。使用 STUHELPER_TEST_PG_BIN 指定 PostgreSQL 程序目录。测试使用合成数据和模拟机器人。

Documentation

Overview

Package groups owns group admission, management and voluntary entertainment.

Index

Constants

View Source
const MaxEventGroups = 1000

A bounded transaction provides all-or-nothing fanout. Overflow is a failure, not a partial acknowledgement; Sweep remains available for periodic recovery.

View Source
const OutboxChannel = "groups_outbox"

Variables

View Source
var (
	ErrUnprocessable   = errors.New("groups_unprocessable")
	ErrInvalid         = errors.New("groups_invalid_request")
	ErrUnauthenticated = errors.New("groups_unauthenticated")
	ErrForbidden       = errors.New("groups_forbidden")
	ErrNotFound        = errors.New("groups_not_found")
	ErrConflict        = errors.New("groups_conflict")
	ErrUnavailable     = errors.New("groups_unavailable")
	ErrDisabled        = errors.New("groups_disabled")
	ErrCooldown        = errors.New("groups_cooldown")
)

Functions

func NewErrorDetail added in v0.1.1

func NewErrorDetail(base error, reason, field string, retryAfter int64) error

func OpenAPI

func OpenAPI() []byte

OpenAPI returns the exact provider contract for consumer compatibility checks.

func TraceParentFromContext added in v0.1.1

func TraceParentFromContext(ctx context.Context) string

TraceParentFromContext returns the active traceparent attached to ctx, if any.

func WithTraceParent added in v0.1.1

func WithTraceParent(ctx context.Context, tp string) context.Context

WithTraceParent attaches a sanitized W3C traceparent token to ctx. Malformed, oversized or control-character headers are ignored so envelopes stay valid.

Types

type Action

type Action struct {
	LeaseUntil *time.Time `json:"lease_until,omitempty"`
	ID         string     `json:"id"`
	Group      string     `json:"group"`
	Actor      Actor      `json:"actor"`
	Capability string     `json:"capability"`
	Command    Command    `json:"command"`
	State      string     `json:"state"`
	Result     string     `json:"result"`
	Created    time.Time  `json:"created"`
}

type ActionQuery added in v0.1.1

type ActionQuery struct {
	Cursor string
	Limit  int
	Order  string
	State  string
	Kind   string
}

type Actor

type Actor struct {
	Issuer  string `json:"issuer"`
	Subject string `json:"subject"`
}

func (Actor) Key

func (a Actor) Key() string

func (Actor) Principal

func (a Actor) Principal() account.Principal

type Analyzer

type Analyzer interface {
	Analyze(context.Context, string) (string, []string, error)
}

type AuditEntry added in v0.1.1

type AuditEntry struct {
	ID     string    `json:"id"`
	Actor  string    `json:"actor"`
	Action string    `json:"action"`
	Target string    `json:"target"`
	Result string    `json:"result"`
	Time   time.Time `json:"time"`
}

type Authorizer

type Authorizer interface {
	Evaluate(context.Context, account.Principal, string, admin.Scope) error
}

type Blacklist

type Blacklist struct {
	ID        string     `json:"id"`
	Reason    string     `json:"reason"`
	Until     time.Time  `json:"until"`
	Permanent bool       `json:"permanent"`
	Created   *time.Time `json:"created,omitempty"`
	Updated   *time.Time `json:"updated,omitempty"`
}

type BlacklistInput

type BlacklistInput struct {
	Groups  []string `json:"groups"`
	Target  string   `json:"target"`
	Reason  string   `json:"reason"`
	Seconds int64    `json:"seconds"`
	Remove  bool     `json:"remove"`
}

type Bot

type Bot interface {
	Execute(context.Context, Action) (Outcome, error)
	Lookup(context.Context, string) (Outcome, bool, error)
}

type BotIdentity

type BotIdentity struct {
	Bot    BotScope
	UserID string
}

type BotScope

type BotScope struct {
	Platform string
	BotID    string
}

BotScope identifies a registered adapter instance. Platform is onebot or official; connect is never a bot transport or evidence of a shared QQ identity.

type Bulk

type Bulk struct {
	Targets []string `json:"targets"`
	Command Command  `json:"command"`
	Preview bool     `json:"preview"`
}

type BulkItem

type BulkItem struct {
	Target string `json:"target"`
	Result Result `json:"result"`
}

type BulkResult

type BulkResult struct {
	Items    []BulkItem        `json:"items"`
	Executed []BulkItem        `json:"executed"`
	Skipped  []BulkSkippedItem `json:"skipped"`
}

type BulkSkippedItem added in v0.1.1

type BulkSkippedItem struct {
	Target     string `json:"target"`
	ReasonCode string `json:"reason_code"`
	Reason     string `json:"reason"`
}

type CardField

type CardField struct {
	Allowed   bool
	Available bool
	Value     string
}

CardField separates disclosure permission from source availability. Only allowed and available fields may enter a group card; absence is not a violation.

type Command

type Command struct {
	Kind     string `json:"kind"`
	Target   string `json:"target,omitempty"`
	Text     string `json:"text,omitempty"`
	Seconds  int64  `json:"seconds,omitempty"`
	Message  string `json:"message,omitempty"`
	Receiver string `json:"receiver,omitempty"`
	Enabled  bool   `json:"enabled,omitempty"`
}

type Delivery

type Delivery struct {
	ID       string `json:"id"`
	Receiver string `json:"receiver"`
	Action   string `json:"action"`
	State    string `json:"state"`
}

type DirectoryGroup added in v0.1.1

type DirectoryGroup struct {
	ID               string `json:"id"`
	School           string `json:"school"`
	Name             string `json:"name"`
	Number           string `json:"number"`
	Category         string `json:"category"`
	Description      string `json:"description"`
	Mode             string `json:"mode"`
	RequireStudent   bool   `json:"require_student"`
	AcceptAlumni     bool   `json:"accept_alumni"`
	AcceptTemporary  bool   `json:"accept_temporary"`
	RequiresPassword bool   `json:"requires_password"`
	PasswordHint     string `json:"password_hint,omitempty"`
	Joined           bool   `json:"joined"`
	State            string `json:"state"`
}

type DirectoryQuery added in v0.1.1

type DirectoryQuery struct {
	School   string
	Category string
	Cursor   string
	Limit    int
}

type DirectoryRecord added in v0.1.1

type DirectoryRecord struct {
	Config GroupConfig
	Member *Member
}

DirectoryRecord joins a discoverable group configuration with the caller's own non-removed membership/application record when one exists.

type EligibilityChange

type EligibilityChange struct {
	Owner    string `json:"owner"`
	Revision int64  `json:"revision"`
}

type ErrorDetail added in v0.1.1

type ErrorDetail struct {
	Base              error
	Reason            string
	Field             string
	RetryAfterSeconds int64
}

func (*ErrorDetail) Error added in v0.1.1

func (e *ErrorDetail) Error() string

func (*ErrorDetail) Unwrap added in v0.1.1

func (e *ErrorDetail) Unwrap() error

type Event

type Event struct {
	SpecVersion string          `json:"specversion"`
	ID          string          `json:"id"`
	Source      string          `json:"source"`
	Type        string          `json:"type"`
	Subject     string          `json:"subject"`
	TraceParent string          `json:"traceparent,omitempty"`
	Time        time.Time       `json:"time"`
	Revision    int64           `json:"revision"`
	Data        json.RawMessage `json:"data"`
	// contains filtered or unexported fields
}

func (Event) RevisionSubject added in v0.1.1

func (e Event) RevisionSubject() string

RevisionSubject selects the object stream while the inbox hashes the original envelope.

type Facts

type Facts struct {
	StudentKnown bool
	StageKnown   bool
	Bound        bool
	Student      bool
	Alumni       bool
	Temporary    bool
	Fields       map[string]CardField
}

Facts contains current eligibility and card disclosure decisions supplied by backend. Bound is true only when all three independent QQ bindings are currently complete.

type FactsProvider

type FactsProvider interface {
	GroupFacts(ctx context.Context, principal account.Principal, owner, school string) (Facts, error)
}

FactsProvider is owned by groups; backend implements all provider mappings. Unknown stages and provider failures must not be turned into valid eligibility.

type GroupConfig

type GroupConfig struct {
	GroupSettings
	Number        string `json:"number"`
	Revision      int64  `json:"revision"`
	PasswordSet   bool   `json:"password_set"`
	PasswordEpoch int64  `json:"password_epoch,omitempty"`
}

type GroupConfigInput

type GroupConfigInput struct {
	GroupSettings
	Number           *string `json:"number,omitempty"`
	ExpectedRevision int64   `json:"expected_revision"`
	Password         *string `json:"password,omitempty"`
}

type GroupCounts

type GroupCounts struct{ Members, Pending int64 }

type GroupSettings

type GroupSettings struct {
	Name             string   `json:"name"`
	BotEnabled       bool     `json:"bot_enabled"`
	Discoverable     bool     `json:"discoverable"`
	Category         string   `json:"category"`
	Description      string   `json:"description"`
	PasswordHint     string   `json:"password_hint"`
	Welcome          string   `json:"welcome"`
	RulesTemplate    string   `json:"rules_template"`
	CheckCard        bool     `json:"check_card"`
	RemindCard       bool     `json:"remind_card"`
	BlockLinks       bool     `json:"block_links"`
	FrequencySeconds int64    `json:"frequency_seconds"`
	FrequencyLimit   int64    `json:"frequency_limit"`
	WarningLimit     int64    `json:"warning_limit"`
	ID               string   `json:"id"`
	School           string   `json:"school"`
	Mode             string   `json:"mode"`
	RequireStudent   bool     `json:"require_student"`
	AcceptAlumni     bool     `json:"accept_alumni"`
	AcceptTemporary  bool     `json:"accept_temporary"`
	GraceSeconds     int64    `json:"grace_seconds"`
	ReminderSeconds  int64    `json:"reminder_seconds"`
	RetentionSeconds int64    `json:"retention_seconds"`
	CardTemplate     string   `json:"card_template"`
	AutoCard         bool     `json:"auto_card"`
	DiceSides        int64    `json:"dice_sides"`
	MuteProbability  int64    `json:"mute_probability"`
	MuteSeconds      int64    `json:"mute_seconds"`
	CooldownSeconds  int64    `json:"cooldown_seconds"`
	Pity             int64    `json:"pity"`
	Keywords         []string `json:"keywords"`
	RepeatThreshold  int64    `json:"repeat_threshold"`
	AutoActions      []string `json:"auto_actions"`
}

type GroupSummary

type GroupSummary struct {
	ID             string `json:"id"`
	School         string `json:"school"`
	Name           string `json:"name"`
	Number         string `json:"number"`
	MemberCount    int64  `json:"member_count"`
	BotEnabled     bool   `json:"bot_enabled"`
	RequireStudent bool   `json:"require_student"`
	PendingCount   int64  `json:"pending_count"`
	Revision       int64  `json:"revision"`
}

type Hit

type Hit struct {
	ID      string     `json:"id"`
	Owner   string     `json:"owner"`
	Message string     `json:"message"`
	Rules   []string   `json:"rules"`
	State   string     `json:"state"`
	Created *time.Time `json:"created,omitempty"`
}

type HitQuery added in v0.1.1

type HitQuery struct {
	Cursor string
	Limit  int
	Order  string
}

type IdentityResolver

type IdentityResolver interface {
	ResolveOwner(ctx context.Context, principal account.Principal, identity BotIdentity) (string, error)
	ResolveBotIdentity(ctx context.Context, principal account.Principal, owner string, bot BotScope) (BotIdentity, error)
}

IdentityResolver is the backend bot bridge's consumer-owned port. The provider must check the current service identity, bot scope and binding on every call. Errors use groups sentinels (errors.Is); unavailable is never a missing binding.

type ListQuery added in v0.1.1

type ListQuery struct {
	Cursor     string
	CursorTime *time.Time
	Limit      int
	Desc       bool
	State      string
	Kind       string
	Joined     *bool
	Exempt     *bool
	Recalled   *bool
}

type ManagedGroup

type ManagedGroup struct {
	ID     string `json:"id"`
	School string `json:"school"`
}

ManagedGroup identifies a configured group; it deliberately omits card fields, messages, raw QQ identifiers and other membership data.

type Member

type Member struct {
	ID            string    `json:"id"`
	Joined        bool      `json:"joined"`
	Owner         string    `json:"owner"`
	State         string    `json:"state"`
	Deadline      time.Time `json:"deadline"`
	Reminder      time.Time `json:"reminder"`
	Password      bool      `json:"password"`
	PasswordEpoch int64     `json:"password_epoch,omitempty"`
	Exempt        bool      `json:"exempt"`
	Extended      bool      `json:"extended"`
	Failures      int64     `json:"failures"`
	LastPlay      time.Time `json:"last_play"`
	MutedUntil    time.Time `json:"muted_until"`
}

type MemberQuery added in v0.1.1

type MemberQuery struct {
	Cursor string
	Limit  int
	State  string
	Joined *bool
	Exempt *bool
}

type Message

type Message struct {
	Attachments []string   `json:"attachments"`
	ID          string     `json:"id"`
	Owner       string     `json:"owner"`
	Body        string     `json:"body"`
	Recalled    bool       `json:"recalled"`
	Expires     time.Time  `json:"expires"`
	Created     *time.Time `json:"created,omitempty"`
}

type MessageQuery added in v0.1.1

type MessageQuery struct {
	Cursor   string
	Limit    int
	Order    string
	Recalled *bool
}

type MyGroup

type MyGroup struct {
	ID                string     `json:"id"`
	Name              string     `json:"name"`
	School            string     `json:"school"`
	Number            string     `json:"number"`
	Joined            bool       `json:"joined"`
	State             string     `json:"state"`
	Deadline          *time.Time `json:"deadline"`
	RequiresPassword  bool       `json:"requires_password"`
	PasswordHint      string     `json:"password_hint,omitempty"`
	Eligibility       string     `json:"eligibility"`
	MissingConditions []string   `json:"missing_conditions"`
	UnknownConditions []string   `json:"unknown_conditions"`
	NextActions       []string   `json:"next_actions"`
	MissingCardFields []string   `json:"missing_card_fields,omitempty"`
}

type OutboxReader

type OutboxReader interface {
	PendingOutbox(ctx context.Context, limit int, excludeSubjects []string) ([]Event, error)
	ConfirmOutbox(ctx context.Context, id string) error
}

OutboxReader is a trusted backend relay port. Exclusions are applied in SQL before ordering and limiting. Confirm only after all consumers commit durably.

type Outcome

type Outcome struct {
	Success bool
	Code    string
}

Bot must deduplicate by Action.ID and query actual outcomes after timeouts. Lookup returns found=false only when no execution took place. Never guess success.

type OwnerGroupRecord

type OwnerGroupRecord struct {
	Config GroupConfig
	Member Member
}

OwnerGroupRecord is internal repository data. Public owner queries still return only ManagedGroup; MyGroups explicitly projects a separate user-safe shape.

type Page

type Page[T any] struct {
	Items      []T    `json:"items"`
	NextCursor string `json:"next_cursor"`
}

type ReadTx added in v0.1.1

type ReadTx interface {
	Get(string, string, any) error
	List(string, string, int) ([]Row, error)
	QueryList(string, ListQuery) ([]Row, error)
	PendingActions(string) (int, error)
	PendingAdmissionKick(group, owner string) (bool, error)
	GroupCounts([]string) (map[string]GroupCounts, error)
	OwnerGroups(owner, cursor string, limit int, includeApplicants bool) (Page[ManagedGroup], error)
	OwnerGroupRecords(owner, cursor string, limit int, includeApplicants bool) (Page[OwnerGroupRecord], error)
	DirectoryGroups(owner, school, category, cursor string, limit int) ([]DirectoryRecord, error)
}

type Report

type Report struct {
	ID          string     `json:"id"`
	Reporter    string     `json:"reporter"`
	Target      string     `json:"target,omitempty"`
	Message     string     `json:"message"`
	Reason      string     `json:"reason"`
	State       string     `json:"state"`
	Analysis    string     `json:"analysis,omitempty"`
	Suggestions []string   `json:"suggestions,omitempty"`
	Feedback    string     `json:"feedback,omitempty"`
	ResolvedBy  *Actor     `json:"resolved_by,omitempty"`
	Created     *time.Time `json:"created,omitempty"`
	Updated     *time.Time `json:"updated,omitempty"`
}

type ReportQuery added in v0.1.1

type ReportQuery struct {
	Cursor string
	Limit  int
	Order  string
	State  string
}

type Repository

type Repository interface {
	ReadOnly(context.Context, func(ReadTx) error) error
	ScopedTransaction(context.Context, []string, func(Tx) error) error
	Transaction(context.Context, func(Tx) error) error
}

type Result

type Result struct {
	ID            string   `json:"id"`
	State         string   `json:"state"`
	Action        string   `json:"action"`
	Value         int64    `json:"value"`
	Detail        string   `json:"detail"`
	MaxValue      *int64   `json:"max_value,omitempty"`
	Seconds       *int64   `json:"seconds,omitempty"`
	PityRemaining *int64   `json:"pity_remaining,omitempty"`
	MissingFields []string `json:"missing_fields,omitempty"`
}

type Row

type Row struct {
	ID        string
	Data      json.RawMessage
	CreatedAt time.Time
}

type Service

type Service struct {
	PlatformIdentity admin.Identity
	Repo             Repository
	Auth             Authorizer
	Facts            FactsProvider
	FactsPrincipal   account.Principal
	Bot              Bot
	AI               Analyzer
	Now              func() time.Time
	Random           func(int64) (int64, error)
	// contains filtered or unexported fields
}

func (*Service) Actions

func (s *Service) Actions(ctx context.Context, p account.Principal, g, cursor string, limit int) (Page[Action], error)

func (*Service) Audits added in v0.1.1

func (s *Service) Audits(ctx context.Context, p account.Principal, g, cursor string, limit int) (Page[AuditEntry], error)

func (*Service) Batch

func (s *Service) Batch(ctx context.Context, p account.Principal, g, key string, in Bulk) (BulkResult, error)

func (*Service) Blacklist

func (s *Service) Blacklist(ctx context.Context, p account.Principal, g, cursor string, limit int) (Page[Blacklist], error)

func (*Service) Blacklists

func (s *Service) Blacklists(ctx context.Context, p account.Principal, key string, in BlacklistInput) (Result, error)

func (*Service) Cleanup

func (s *Service) Cleanup(ctx context.Context, g, cursor string) (string, error)

func (*Service) CleanupFrequency added in v0.1.1

func (s *Service) CleanupFrequency(ctx context.Context, g, cursor string) (string, error)

CleanupFrequency removes bounded pages of expired message rate-limit windows for group g.

func (*Service) CleanupIdempotency added in v0.1.1

func (s *Service) CleanupIdempotency(ctx context.Context, bucketName, cursor string, maxAge time.Duration) (string, error)

CleanupIdempotency removes bounded pages of expired idempotency receipts or batch_inputs (default 24h).

func (*Service) CleanupOutbox added in v0.1.1

func (s *Service) CleanupOutbox(ctx context.Context, maxAge time.Duration) (int, error)

CleanupOutbox deletes at most 100 confirmed historical outbox rows older than maxAge (default 24h). Unsent or held outbox rows are never deleted.

func (*Service) Command

func (s *Service) Command(ctx context.Context, p account.Principal, g, key string, cmd Command) (Result, error)

func (*Service) Configuration

func (s *Service) Configuration(ctx context.Context, p account.Principal, g string) (GroupConfig, error)

func (*Service) Configure

func (s *Service) Configure(ctx context.Context, p account.Principal, key string, in GroupConfigInput) (GroupConfig, error)

func (*Service) Consume

func (s *Service) Consume(ctx context.Context, event UpstreamEvent) error

Consume atomically records inbox/revision and reevaluates all affected groups. Source data only identifies the owner: current facts always come from Facts.

func (*Service) Deliveries

func (s *Service) Deliveries(ctx context.Context, p account.Principal, g, cursor string, limit int) (Page[Delivery], error)

func (*Service) Directory added in v0.1.1

Directory returns student-facing public cards for discoverable groups. Groups requiring student verification are shown only when the caller holds valid campus eligibility in that school; groups without student requirement remain publicly discoverable to authenticated users unless restricted by blacklist.

func (*Service) Execute

func (s *Service) Execute(ctx context.Context, g, id string) (Action, error)

Execute serializes claims before an external call. Interrupted calls remain unknown and are resolved via Lookup on the next invocation with the same ID.

func (*Service) Fanout

func (s *Service) Fanout(ctx context.Context, e Event) error

Fanout consumes committed disposition events, independently queuing each enabled recipient. Delivery state is the recipient action's actual state.

func (*Service) Groups

func (s *Service) Groups(ctx context.Context, p account.Principal, cursor string, limit int) (Page[GroupSummary], error)

func (*Service) GroupsForOwner

func (s *Service) GroupsForOwner(ctx context.Context, owner account.Principal, cursor string, limit int) (Page[ManagedGroup], error)

GroupsForOwner is a trusted backend query, not an HTTP authorization bypass. It returns joined, non-removed memberships whose group configuration exists.

func (*Service) Hits

func (s *Service) Hits(ctx context.Context, p account.Principal, g, cursor string, limit int) (Page[Hit], error)

func (*Service) Ingest

func (s *Service) Ingest(ctx context.Context, g string, event Event, m Message) error

Ingest is a trusted backend boundary, never mounted as a public route. Only authenticated bot adapters may provide the actual group and sender.

func (*Service) MemberEvent

func (s *Service) MemberEvent(ctx context.Context, g string, event Event, owner string) error

MemberEvent receives verified group membership from the host bot adapter. A web application alone cannot claim that a QQ user has already joined.

func (*Service) Members

func (s *Service) Members(ctx context.Context, p account.Principal, g, cursor string, limit int) (Page[Member], error)

func (*Service) Messages

func (s *Service) Messages(ctx context.Context, p account.Principal, g, cursor string, limit int) (Page[Message], error)

func (*Service) MyGroups

func (s *Service) MyGroups(ctx context.Context, p account.Principal, cursor string, limit int) (Page[MyGroup], error)

MyGroups shares the indexed reverse lookup behind GroupsForOwner, including active applications. The only owner is the authenticated principal; no caller supplied owner, admin scope, or content fields enter the response.

func (*Service) Progress

func (s *Service) Progress(ctx context.Context, p account.Principal, g string) (Member, error)

func (*Service) QueryActions added in v0.1.1

func (s *Service) QueryActions(ctx context.Context, p account.Principal, g string, q ActionQuery) (Page[Action], error)

func (*Service) QueryHits added in v0.1.1

func (s *Service) QueryHits(ctx context.Context, p account.Principal, g string, q HitQuery) (Page[Hit], error)

func (*Service) QueryMembers added in v0.1.1

func (s *Service) QueryMembers(ctx context.Context, p account.Principal, g string, q MemberQuery) (Page[Member], error)

func (*Service) QueryMessages added in v0.1.1

func (s *Service) QueryMessages(ctx context.Context, p account.Principal, g string, q MessageQuery) (Page[Message], error)

func (*Service) QueryReports added in v0.1.1

func (s *Service) QueryReports(ctx context.Context, p account.Principal, g string, q ReportQuery) (Page[Report], error)

func (*Service) Recover

func (s *Service) Recover(ctx context.Context, g, cursor string) (string, error)

Recover is called by the host for expired execution leases, with bounded pages.

func (*Service) Reports

func (s *Service) Reports(ctx context.Context, p account.Principal, g, cursor string, limit int) (Page[Report], error)

func (*Service) Subscriptions

func (s *Service) Subscriptions(ctx context.Context, p account.Principal, g, cursor string, limit int) (Page[Subscription], error)

func (*Service) Sweep

func (s *Service) Sweep(ctx context.Context, g, cursor string) (string, error)

Sweep is a bounded host job for qualification deadlines and reminders. Host persists its cursor and periodically starts at the beginning for new deadlines.

func (*Service) Warnings

func (s *Service) Warnings(ctx context.Context, p account.Principal, g, cursor string, limit int) (Page[Warnings], error)

func (*Service) Watch

func (s *Service) Watch(ctx context.Context, p account.Principal, g, cursor string, limit int) (Page[Watch], error)

type Subscription

type Subscription struct {
	ID       string `json:"id"`
	Receiver string `json:"receiver"`
	Enabled  bool   `json:"enabled"`
	Actor    Actor  `json:"actor"`
}

type Tx

type Tx interface {
	ReadTx
	Put(string, string, any) error
	Delete(string, string) error
	DeleteSentOutboxBefore(cutoff time.Time, limit int) (int, error)
	Emit(Event) error
	Accept(Event) (bool, error)
}

type UpstreamEvent

type UpstreamEvent struct {
	SpecVersion     string            `json:"specversion"`
	ID              string            `json:"id"`
	Source          string            `json:"source"`
	Type            string            `json:"type"`
	Subject         string            `json:"subject"`
	TraceParent     string            `json:"traceparent,omitempty"`
	Time            time.Time         `json:"time"`
	DataContentType string            `json:"datacontenttype"`
	SchoolID        string            `json:"schoolid,omitempty"`
	Data            EligibilityChange `json:"data"`
}

UpstreamEvent uses the providers' public CloudEvents shape. Preserve source and subject: verification uses object streams; qq-binding uses an owner stream.

type Warnings

type Warnings struct {
	ID    string `json:"id"`
	Count int64  `json:"count"`
}

type Watch

type Watch struct {
	ID      string     `json:"id"`
	Enabled bool       `json:"enabled"`
	Reason  string     `json:"reason"`
	Created *time.Time `json:"created,omitempty"`
	Updated *time.Time `json:"updated,omitempty"`
}

Directories

Path Synopsis
Package accountquery provides the module-owned account investigation port.
Package accountquery provides the module-owned account investigation port.
Package httpapi accepts principals only from the host authentication middleware.
Package httpapi accepts principals only from the host authentication middleware.
Package postgres owns all groups SQL.
Package postgres owns all groups SQL.
Package sdk provides primitives to interact with the openapi HTTP API.
Package sdk provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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