Help us shape the future of Go! Take the 2026 Go Developer Survey

channels

package
v0.131.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package channels manages authoring homes and their public identity. Channels are not metadata: their AuthKit groups govern their original content items.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card struct {
	ID           string                 `json:"id"`
	Slug         string                 `json:"slug"`
	Name         string                 `json:"name"`
	NameLanguage string                 `json:"name_language,omitempty"`
	Code         string                 `json:"code,omitempty"`
	Path         string                 `json:"path,omitempty"`
	Cover        *entities.Cover        `json:"cover,omitempty"`
	Avatar       *entities.Avatar       `json:"avatar,omitempty"`
	Count        int                    `json:"count"`
	Access       *entities.EntityAccess `json:"access,omitempty"`
	CreatedAt    time.Time              `json:"created_at"`
}

Card is a channel's public identity and optional paid membership standing.

type Channel

type Channel struct {
	Card
	State       entities.State        `json:"state"`
	OwnerUserID string                `json:"owner_user_id,omitempty"`
	AuthScope   string                `json:"auth_scope,omitempty"`
	Revision    int64                 `json:"revision"`
	UpdatedAt   time.Time             `json:"updated_at"`
	Names       []entities.Name       `json:"names"`
	Text        []entities.Text       `json:"text"`
	Counts      []entities.Count      `json:"counts"`
	Entities    []entities.EntityCard `json:"entities"`
}

Channel includes editable identity and metadata. Metadata grants no authority.

type Import

type Import struct {
	ID          string
	Slug        string
	State       entities.State
	Cover       *entities.Cover
	Avatar      *entities.Avatar
	OwnerUserID string
	AuthScope   string
	Names       []entities.Name
	Text        []entities.Text
	Code        string
	CreatedAt   *time.Time
	UpdatedAt   *time.Time
}

Import is a channel's explicit imported identity. Source media, public codes and authorization group IDs remain stable. Omitted names/text preserve them.

type Input

type Input struct {
	Slug   string           `json:"slug"`
	Names  []entities.Name  `json:"names,omitempty"`
	Text   []entities.Text  `json:"text,omitempty"`
	Cover  *entities.Cover  `json:"cover,omitempty"`
	Avatar *entities.Avatar `json:"avatar,omitempty"`
}

type ListOptions

type ListOptions struct {
	Language string
	Slug     string
	Query    string
	Cursor   string
	Limit    int
	Sort     entities.Sort
	State    string
}

type Mine

type Mine struct {
	Card
	Owner      bool `json:"owner"`
	Editor     bool `json:"editor"`
	CanPost    bool `json:"can_post"`
	CanEditOwn bool `json:"can_edit_own"`
	Writer     bool `json:"writer"`
	Moderator  bool `json:"moderator"`
	Member     bool `json:"member"`
}

Mine includes current authoring permissions, not the creator's past authority.

type MyPage

type MyPage struct {
	Channels   []Mine `json:"channels"`
	NextCursor string `json:"next_cursor,omitempty"`
}

type Options

type Options struct {
	Pool   *pgxpool.Pool
	Schema string
	Tenant string
	Model  kinds.Config
	Scopes entities.Scopes
}

type Page

type Page struct {
	Channels   []Card `json:"channels"`
	NextCursor string `json:"next_cursor,omitempty"`
	Total      *int   `json:"total,omitempty"`
}

type Repost

type Repost struct {
	ChannelID string    `json:"channel_id"`
	ActorID   string    `json:"actor_id,omitempty"`
	CreatedAt time.Time `json:"created_at"`
	CanRemove bool      `json:"can_remove"`
}

Repost identifies the destination reference without copying original content.

type Store

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

Store is a catalog's channels. Existing persisted identity, media and scope bytes are retained; callers only see this typed channel interface.

func FromStore

func FromStore(storage *entities.Store) *Store

FromStore binds channel storage to the engine's existing catalog dependencies.

func New

func New(opts Options) (*Store, error)

New opens a standalone channel store, for example for a staff role CLI. It does not migrate, seed channels or construct another authentication server.

func (*Store) As

func (s *Store) As(a auth.Authenticator, actor access.Actor) *Store

func (*Store) Cards

func (s *Store) Cards(ctx context.Context, ids []string, language string) ([]Card, error)

func (*Store) Create

func (s *Store) Create(ctx context.Context, in Input) (Channel, error)

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, id string) error

Delete withdraws the channel and completes its group/content lifecycle synchronously. Retained media remains owned by the existing purge sweep.

func (*Store) Finish

func (s *Store) Finish(ctx context.Context, ids []string) error

Finish completes synchronous cross-store lifecycle operations after a caller-owned import transaction commits. Retrying the same IDs is safe.

func (*Store) Get

func (s *Store) Get(ctx context.Context, id, language string) (Channel, error)

func (*Store) Handler

func (s *Store) Handler(a auth.Authenticator) (http.Handler, error)

func (*Store) ImportDeletesTx

func (s *Store) ImportDeletesTx(ctx context.Context, tx pgx.Tx, ids []string) error

func (*Store) ImportTx

func (s *Store) ImportTx(ctx context.Context, tx pgx.Tx, in []Import, provision bool) error

ImportTx stores identities in the import transaction. Call Finish after commit to apply the corresponding AuthKit operation synchronously.

func (*Store) List

func (s *Store) List(ctx context.Context, in ListOptions) (Page, error)

func (*Store) ManagementGet

func (s *Store) ManagementGet(ctx context.Context, id, language string) (Channel, error)

func (*Store) ManagementList

func (s *Store) ManagementList(ctx context.Context, in ListOptions) (Page, error)

func (*Store) Metadata

func (s *Store) Metadata(ctx context.Context, id, language string) ([]entities.EntityCard, error)

func (*Store) Mine

func (s *Store) Mine(ctx context.Context, in ListOptions) (MyPage, error)

func (*Store) Raw

func (s *Store) Raw(ctx context.Context, id string) (entities.Entity, error)

Raw returns channel identity for the engine's permission/media adapters. It is not exposed by the HTTP contract.

func (*Store) RawMany

func (s *Store) RawMany(ctx context.Context, ids []string) ([]entities.Entity, error)

func (*Store) SetMetadata

func (s *Store) SetMetadata(ctx context.Context, id string, ids []string) error

func (*Store) Update

func (s *Store) Update(ctx context.Context, id string, in Update) (Channel, error)

type Update

type Update struct {
	ID          string           `json:"-"`
	OwnerUserID *string          `json:"owner_user_id,omitempty"`
	Slug        *string          `json:"slug,omitempty"`
	Names       []entities.Name  `json:"names,omitempty"`
	Text        []entities.Text  `json:"text,omitempty"`
	Cover       *entities.Cover  `json:"cover,omitempty"`
	Avatar      *entities.Avatar `json:"avatar,omitempty"`
	State       *entities.State  `json:"state,omitempty"`
}

Jump to

Keyboard shortcuts

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