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

sharing

package
v0.232.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package sharing tracks which users have granted which other users read-only access to their aggregated dashboard. It owns no opinion about what a dashboard is — internal/api resolves a share into an actual dashboard.Manager lookup.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store persists sharing relationships: ownerID has shared their dashboard with viewerID.

func NewStore

func NewStore(db *sql.DB) *Store

NewStore wraps db. Init must be called once before any other method.

func (*Store) DeleteUser

func (s *Store) DeleteUser(ctx context.Context, userID []byte) error

DeleteUser removes every share userID appears in, as either owner or viewer — used when an admin removes an account outright.

func (*Store) Init

func (s *Store) Init(ctx context.Context) error

Init creates the schema if it doesn't already exist. Safe to call every startup.

func (*Store) IsSharedWith

func (s *Store) IsSharedWith(ctx context.Context, ownerID, viewerID []byte) (bool, error)

IsSharedWith reports whether ownerID has shared their dashboard with viewerID.

func (*Store) Share

func (s *Store) Share(ctx context.Context, ownerID, viewerID []byte) error

Share grants viewerID read access to ownerID's dashboard. Idempotent — sharing with the same viewer twice changes nothing.

func (*Store) SharedWith

func (s *Store) SharedWith(ctx context.Context, ownerID []byte) ([][]byte, error)

SharedWith returns every user ID ownerID has shared their dashboard with.

func (*Store) SharedWithMe

func (s *Store) SharedWithMe(ctx context.Context, viewerID []byte) ([][]byte, error)

SharedWithMe returns every user ID that has shared their dashboard with viewerID.

func (*Store) Unshare

func (s *Store) Unshare(ctx context.Context, ownerID, viewerID []byte) error

Unshare revokes viewerID's access to ownerID's dashboard — a no-op if it was never granted.

Jump to

Keyboard shortcuts

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