mock

package
v0.0.0-...-bf7cbd6 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthService

type AuthService struct {
	GetUserFn func(ctx context.Context, id string) (*domain.User, error)
	SignUpFn  func(ctx context.Context, username string, password password.Password) (*domain.User, error)
}

func (*AuthService) GetUser

func (as *AuthService) GetUser(ctx context.Context, id string) (*domain.User, error)

func (*AuthService) SignUp

func (as *AuthService) SignUp(ctx context.Context, username string, password password.Password) (*domain.User, error)

type CheevosService

type CheevosService struct {
	AwardCheevoToUserFn func(ctx context.Context, recipientID, cheevoID string) error
	CreateCheevoFn      func(ctx context.Context, name, description, orgID string) (*domain.Cheevo, error)
	GetCheevoFn         func(ctx context.Context, id string) (*domain.Cheevo, error)
}

func (*CheevosService) AwardCheevoToUser

func (cs *CheevosService) AwardCheevoToUser(ctx context.Context, recipientID, cheevoID string) error

func (*CheevosService) CreateCheevo

func (cs *CheevosService) CreateCheevo(ctx context.Context, name, description, orgID string) (*domain.Cheevo, error)

func (*CheevosService) GetCheevo

func (cs *CheevosService) GetCheevo(ctx context.Context, id string) (*domain.Cheevo, error)

type Database

type Database struct{}

func (*Database) Exec

func (db *Database) Exec(ctx context.Context, query string, args ...interface{}) error

func (*Database) QueryRow

func (db *Database) QueryRow(ctx context.Context, query string, args ...interface{}) pg.Row

QueryRow is just a dummy placeholder to make Database implement the service.Database interface. Service methods should never call this directly so we panic if they do.

func (*Database) WithTx

func (db *Database) WithTx(ctx context.Context, f func(ctx context.Context, tx pg.Tx) error) error

WithTx fully implements the github.com/haleyrc/cheevos.Database interface.

type DeleteInvitationByCodeArgs

type DeleteInvitationByCodeArgs struct {
	Code string
}

type Emailer

type Emailer struct {
	SendInvitationFn     func(ctx context.Context, email, code string) error
	SendInvitationCalled struct {
		Count int
		With  SendInvitationArgs
	}
}

func (*Emailer) SendInvitation

func (e *Emailer) SendInvitation(ctx context.Context, email, code string) error

type GetCheevoArgs

type GetCheevoArgs struct {
	ID string
}

type GetInvitationArgs

type GetInvitationArgs struct {
	ID string
}

type GetInvitationByCodeArgs

type GetInvitationByCodeArgs struct {
	Code string
}

type GetMembershipArgs

type GetMembershipArgs struct {
	OrganizationID string
	UserID         string
}

type GetUserArgs

type GetUserArgs struct {
	ID string
}

type InsertAwardArgs

type InsertAwardArgs struct {
	Award *domain.Award
}

type InsertCheevoArgs

type InsertCheevoArgs struct {
	Cheevo *domain.Cheevo
}

type InsertInvitationArgs

type InsertInvitationArgs struct {
	Invitation *domain.Invitation
	HashedCode string
}

type InsertMembershipArgs

type InsertMembershipArgs struct {
	Membership *domain.Membership
}

type InsertOrganizationArgs

type InsertOrganizationArgs struct {
	Organization *domain.Organization
}

type InsertUserArgs

type InsertUserArgs struct {
	User         *domain.User
	PasswordHash string
}

type Repository

type Repository struct {
	DeleteInvitationByCodeFn     func(ctx context.Context, tx pg.Tx, code string) error
	DeleteInvitationByCodeCalled struct {
		Count int
		With  DeleteInvitationByCodeArgs
	}

	GetCheevoFn     func(ctx context.Context, tx pg.Tx, cheevo *domain.Cheevo, id string) error
	GetCheevoCalled struct {
		Count int
		With  GetCheevoArgs
	}

	GetInvitationFn     func(ctx context.Context, tx pg.Tx, i *domain.Invitation, id string) error
	GetInvitationCalled struct {
		Count int
		With  GetInvitationArgs
	}

	GetInvitationByCodeFn     func(ctx context.Context, tx pg.Tx, i *domain.Invitation, code string) error
	GetInvitationByCodeCalled struct {
		Count int
		With  GetInvitationByCodeArgs
	}

	GetMembershipFn     func(ctx context.Context, tx pg.Tx, m *domain.Membership, orgID, userID string) error
	GetMembershipCalled struct {
		Count int
		With  GetMembershipArgs
	}

	GetUserFn     func(ctx context.Context, tx pg.Tx, u *domain.User, id string) error
	GetUserCalled struct {
		Count int
		With  GetUserArgs
	}

	InsertAwardFn     func(ctx context.Context, tx pg.Tx, a *domain.Award) error
	InsertAwardCalled struct {
		Count int
		With  InsertAwardArgs
	}

	InsertCheevoFn     func(ctx context.Context, tx pg.Tx, cheevo *domain.Cheevo) error
	InsertCheevoCalled struct {
		Count int
		With  InsertCheevoArgs
	}

	InsertInvitationFn     func(ctx context.Context, tx pg.Tx, i *domain.Invitation, hashedCode string) error
	InsertInvitationCalled struct {
		Count int
		With  InsertInvitationArgs
	}

	InsertMembershipFn     func(ctx context.Context, tx pg.Tx, m *domain.Membership) error
	InsertMembershipCalled struct {
		Count int
		With  InsertMembershipArgs
	}

	InsertOrganizationFn     func(ctx context.Context, tx pg.Tx, org *domain.Organization) error
	InsertOrganizationCalled struct {
		Count int
		With  InsertOrganizationArgs
	}

	InsertUserFn     func(ctx context.Context, tx pg.Tx, u *domain.User, hashedPassword string) error
	InsertUserCalled struct {
		Count int
		With  InsertUserArgs
	}

	UpdateInvitationFn     func(ctx context.Context, tx pg.Tx, i *domain.Invitation, hashedCode string) error
	UpdateInvitationCalled struct {
		Count int
		With  UpdateInvitationArgs
	}
}

func (*Repository) DeleteInvitationByCode

func (repo *Repository) DeleteInvitationByCode(ctx context.Context, tx pg.Tx, code string) error

func (*Repository) GetCheevo

func (repo *Repository) GetCheevo(ctx context.Context, tx pg.Tx, cheevo *domain.Cheevo, id string) error

func (*Repository) GetInvitation

func (repo *Repository) GetInvitation(ctx context.Context, tx pg.Tx, i *domain.Invitation, id string) error

func (*Repository) GetInvitationByCode

func (repo *Repository) GetInvitationByCode(ctx context.Context, tx pg.Tx, i *domain.Invitation, code string) error

func (*Repository) GetMembership

func (repo *Repository) GetMembership(ctx context.Context, tx pg.Tx, m *domain.Membership, orgID, userID string) error

func (*Repository) GetUser

func (repo *Repository) GetUser(ctx context.Context, tx pg.Tx, u *domain.User, id string) error

func (*Repository) InsertAward

func (repo *Repository) InsertAward(ctx context.Context, tx pg.Tx, a *domain.Award) error

func (*Repository) InsertCheevo

func (repo *Repository) InsertCheevo(ctx context.Context, tx pg.Tx, cheevo *domain.Cheevo) error

func (*Repository) InsertInvitation

func (repo *Repository) InsertInvitation(ctx context.Context, tx pg.Tx, i *domain.Invitation, hashedCode string) error

func (*Repository) InsertMembership

func (repo *Repository) InsertMembership(ctx context.Context, tx pg.Tx, m *domain.Membership) error

func (*Repository) InsertOrganization

func (repo *Repository) InsertOrganization(ctx context.Context, tx pg.Tx, org *domain.Organization) error

func (*Repository) InsertUser

func (repo *Repository) InsertUser(ctx context.Context, tx pg.Tx, u *domain.User, hashedPassword string) error

func (*Repository) UpdateInvitation

func (repo *Repository) UpdateInvitation(ctx context.Context, tx pg.Tx, i *domain.Invitation, hashedCode string) error

type RosterService

type RosterService struct {
	AcceptInvitationFn         func(ctx context.Context, userID, code string) error
	AddMemberToOrganizationFn  func(ctx context.Context, userID, orgID string) error
	CreateOrganizationFn       func(ctx context.Context, name, ownerID string) (*domain.Organization, error)
	DeclineInvitationFn        func(ctx context.Context, code string) error
	GetInvitationFn            func(ctx context.Context, id string) (*domain.Invitation, error)
	InviteUserToOrganizationFn func(ctx context.Context, email, orgID string) (*domain.Invitation, error)
	IsMemberFn                 func(ctx context.Context, orgID, userID string) error
	RefreshInvitationFn        func(ctx context.Context, id string) (*domain.Invitation, error)
}

func (*RosterService) AcceptInvitation

func (rs *RosterService) AcceptInvitation(ctx context.Context, userID, code string) error

func (*RosterService) AddMemberToOrganization

func (rs *RosterService) AddMemberToOrganization(ctx context.Context, userID, orgID string) error

func (*RosterService) CreateOrganization

func (rs *RosterService) CreateOrganization(ctx context.Context, name, ownerID string) (*domain.Organization, error)

func (*RosterService) DeclineInvitation

func (rs *RosterService) DeclineInvitation(ctx context.Context, code string) error

func (*RosterService) GetInvitation

func (rs *RosterService) GetInvitation(ctx context.Context, id string) (*domain.Invitation, error)

func (*RosterService) InviteUserToOrganization

func (rs *RosterService) InviteUserToOrganization(ctx context.Context, email, orgID string) (*domain.Invitation, error)

func (*RosterService) IsMember

func (rs *RosterService) IsMember(ctx context.Context, orgID, userID string) error

func (*RosterService) RefreshInvitation

func (rs *RosterService) RefreshInvitation(ctx context.Context, id string) (*domain.Invitation, error)

type SendInvitationArgs

type SendInvitationArgs struct{ Email, Code string }

type UpdateInvitationArgs

type UpdateInvitationArgs struct {
	Invitation *domain.Invitation
	HashedCode string
}

Jump to

Keyboard shortcuts

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