db

package
v3.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	Get(context.Context, func(pgx.Row) error, string, ...any) error
	Create(context.Context, string, ...any) (uint64, error)
	One(context.Context, string, ...any) error
	List(context.Context, func(pgx.Rows) error, string, ...any) error
	DoAtomic(context.Context, func(context.Context) error) error
}

type Service

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

func New

func New(db Database) Service

func (Service) Create

func (s Service) Create(ctx context.Context, name string) (model.User, error)

func (Service) CreateBasic added in v3.0.1

func (s Service) CreateBasic(ctx context.Context, login, password string) (model.User, error)

func (Service) CreateDiscord added in v3.4.2

func (s Service) CreateDiscord(ctx context.Context, id, username, avatar string) (model.User, error)

func (Service) CreateGithub added in v3.0.1

func (s Service) CreateGithub(ctx context.Context, id uint64, login string) (model.User, error)
func (s Service) CreateLink(ctx context.Context, externalID, description string) (string, error)

func (Service) Delete

func (s Service) Delete(ctx context.Context, o model.User) error

func (Service) DoAtomic

func (s Service) DoAtomic(ctx context.Context, action func(context.Context) error) error

func (Service) GetBasicUser

func (s Service) GetBasicUser(ctx context.Context, login, password string) (model.User, error)

func (Service) GetDiscordUser added in v3.1.0

func (s Service) GetDiscordUser(ctx context.Context, id string) (model.User, error)

func (Service) GetGitHubUser

func (s Service) GetGitHubUser(ctx context.Context, id uint64) (model.User, error)

func (Service) GetLinkByToken added in v3.6.1

func (s Service) GetLinkByToken(ctx context.Context, token string) (model.Link, error)

func (Service) IsAuthorized

func (s Service) IsAuthorized(ctx context.Context, user model.User, profile string) bool

func (Service) List added in v3.4.0

func (s Service) List(ctx context.Context, ids ...string) ([]model.User, error)
func (s Service) Unlink(ctx context.Context, externalID string) error

func (Service) UpdateDiscordUser added in v3.1.0

func (s Service) UpdateDiscordUser(ctx context.Context, user model.User, id, username, avatar string) (model.User, error)

func (Service) UpdateGitHubUser

func (s Service) UpdateGitHubUser(ctx context.Context, user model.User, githubID uint64, githubLogin string) (model.User, error)

func (Service) UpdatePassword

func (s Service) UpdatePassword(ctx context.Context, user model.User, password string) error

Jump to

Keyboard shortcuts

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