db

package
v3.12.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 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

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

func (Service) CreateDiscord

func (s Service) CreateDiscord(ctx context.Context, invite model.User, user model.DiscordUser) (model.User, error)

func (Service) CreateGithub

func (s Service) CreateGithub(ctx context.Context, invite model.User, user model.GitHubUser) (model.User, error)

func (Service) CreateGoogle

func (s Service) CreateGoogle(ctx context.Context, invite model.User, user model.GoogleUser) (model.User, error)

func (Service) CreateInvite

func (s Service) CreateInvite(ctx context.Context, description string) (model.User, string, error)

func (Service) Delete

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

func (Service) DeleteInvite

func (s Service) DeleteInvite(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

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) GetGoogleUser

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

func (Service) GetInviteByID

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

func (Service) GetInviteByToken

func (s Service) GetInviteByToken(ctx context.Context, token string) (model.User, error)

func (Service) IsAuthorized

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

func (Service) List

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

func (Service) UpdateDiscordUser

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) UpdateGoogleUser

func (s Service) UpdateGoogleUser(ctx context.Context, user model.User, googleID, name, picture 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