groups

package
v1.1.72 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0 modules, 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.

Documentation

Overview

Package groups owns ProductCore group CRUD, listing, lifecycle, and policy actions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecordFromView

func RecordFromView(view View) dirextalkdomain.GroupRecord

func RecordsFromViews

func RecordsFromViews(views []View) []dirextalkdomain.GroupRecord

Types

type Config

type Config struct {
	CreateRoom         func(context.Context, View) (string, *actionbase.Error)
	SaveOwnerMember    func(context.Context, string) error
	PublishState       func(context.Context, View, bool) error
	SetMemberMute      func(context.Context, string, bool) *actionbase.Error
	RequireOwner       func(context.Context, string) *actionbase.Error
	OwnerMXID          func() string
	CreateAgentBinding func(context.Context, string, bool) (*dirextalkdomain.GroupAgentBinding, *actionbase.Error)
	BeforeDissolve     func(context.Context, string) error
}

Config contains the narrow Matrix, membership, and identity boundaries used by group workflows. Durable group and conversation state remain module-owned.

type ConversationPort

type ConversationPort interface {
	Save(ctx context.Context, record dirextalkdomain.ConversationRecord) error
	DeleteKindByRoom(ctx context.Context, roomID string, kind dirextalkdomain.ConversationKind) error
	Operation(ctx context.Context, action, status, roomID string) (map[string]any, *dirextalkdomain.ConversationView, error)
}

ConversationPort owns the related durable conversation projection.

type Module

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

func New

func New(store Store, conversation ConversationPort, cfg Config) *Module

func (*Module) ByRoom

func (m *Module) ByRoom(ctx context.Context, roomID string) (View, bool, error)

func (*Module) Create

func (m *Module) Create(ctx context.Context, raw map[string]any) (any, *actionbase.Error)

func (*Module) Delete

func (m *Module) Delete(ctx context.Context, roomID string) error

Delete removes the durable group before removing its group conversation.

func (*Module) Dissolve

func (m *Module) Dissolve(ctx context.Context, raw map[string]any) (any, *actionbase.Error)

func (*Module) Handlers

func (m *Module) Handlers() map[string]actionbase.Handler

Handlers returns the exact ProductCore action surface owned by the module.

func (*Module) List

func (m *Module) List(ctx context.Context) ([]View, error)

func (*Module) ListJoined

func (m *Module) ListJoined(ctx context.Context, userID string) ([]View, error)

func (*Module) Save

func (m *Module) Save(ctx context.Context, group View) error

Save persists the durable group before refreshing its conversation record.

func (*Module) Update

func (m *Module) Update(ctx context.Context, raw map[string]any) (any, *actionbase.Error)

func (*Module) WithOperation

func (m *Module) WithOperation(ctx context.Context, group View, action, status string) (View, error)

WithOperation attaches the response-only conversation operation fields.

type Store

type Store interface {
	UpsertGroup(ctx context.Context, group dirextalkdomain.GroupRecord) error
	DeleteGroup(ctx context.Context, roomID string) error
	ListGroups(ctx context.Context) ([]dirextalkdomain.GroupRecord, error)
	GetGroupByRoom(ctx context.Context, roomID string) (dirextalkdomain.GroupRecord, bool, error)
	ListJoinedGroupsForUser(ctx context.Context, userID string) ([]dirextalkdomain.GroupRecord, error)
}

Store is the durable group repository used by Module.

type View

type View struct {
	RoomID            string                             `json:"room_id"`
	Name              string                             `json:"name"`
	Topic             string                             `json:"topic"`
	AvatarURL         string                             `json:"avatar_url"`
	MemberCount       int64                              `json:"member_count"`
	InvitePolicy      string                             `json:"invite_policy"`
	Muted             bool                               `json:"muted"`
	Operation         map[string]any                     `json:"operation,omitempty"`
	Conversation      *dirextalkdomain.ConversationView  `json:"conversation,omitempty"`
	AgentBinding      *dirextalkdomain.GroupAgentBinding `json:"agent_binding,omitempty"`
	AgentBindingError string                             `json:"agent_binding_error,omitempty"`
}

View is the public ProductCore group response. Operation and Conversation are response-only presentation fields and are never written to Store.

func ViewFromRecord

func ViewFromRecord(record dirextalkdomain.GroupRecord) View

func ViewsFromRecords

func ViewsFromRecords(records []dirextalkdomain.GroupRecord) []View

Jump to

Keyboard shortcuts

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