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

accountsql

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

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

func New

func New(store Storage, datasets accounts.Datasets, expired func(string) string) *Repository

func (*Repository) AuthenticateBearer

func (s *Repository) AuthenticateBearer(ctx context.Context, secret string) (accounts.Principal, error)

func (*Repository) AuthenticateSession

func (s *Repository) AuthenticateSession(ctx context.Context, secret string) (accounts.Principal, error)

func (*Repository) Cleanup

func (s *Repository) Cleanup(ctx context.Context) error

Cleanup removes expired credentials in bounded transactions. Revoked token IDs remain available to operators; evidence and datasets are never touched.

func (*Repository) CreateSession

func (s *Repository) CreateSession(ctx context.Context, token string) (string, time.Time, error)

func (*Repository) CreateToken

func (s *Repository) CreateToken(ctx context.Context, userID string, scopes []string, expires *time.Time) (accounts.Token, error)

func (*Repository) CreateUser

func (s *Repository) CreateUser(ctx context.Context, name string) (accounts.User, error)

func (*Repository) DisableUser

func (s *Repository) DisableUser(ctx context.Context, userID string) error

func (*Repository) EnsureDefault

func (s *Repository) EnsureDefault(ctx context.Context) error

func (*Repository) Logout

func (s *Repository) Logout(ctx context.Context, secret string) error

func (*Repository) ReprocessUser

func (s *Repository) ReprocessUser(ctx context.Context, userID string) (int64, error)

ReprocessUser resolves the operator's user ID to its server-owned dataset.

func (*Repository) Resume

func (s *Repository) Resume(ctx context.Context) error

Resume completes only pending provisioning; disabled ready users stay disabled.

func (*Repository) RevokeToken

func (s *Repository) RevokeToken(ctx context.Context, id string) error

type Storage

type Storage interface {
	SQL() *sql.DB
	WriteTransaction(context.Context, func(*sql.Tx) error) error
}

Jump to

Keyboard shortcuts

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