services

package
v0.0.0-...-c1868ec Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FriendInterface

type FriendInterface interface {
	FetchFriendsAndInfo(ctx context.Context, friendList []string) ([]*models.FriendDetails, error)
	AddFriend(ctx context.Context, playerID string, friendID string) error
	RemoveFriend(ctx context.Context, playerID string, friendID string) error
	AcceptIncomingFriendRequest(ctx context.Context, playerID string, friendID string) error
	RejectIncomingFriendRequest(ctx context.Context, playerID string, friendID string) error
}

func ReturnFriendService

func ReturnFriendService() (FriendInterface, error)

type FriendService

type FriendService struct {
	//DBs
	MongoDAO mongodb.MongoDBClient
	RedisDAO redis.RedisCacheClient

	FriendRequestType func(string) int32
}

func (*FriendService) AcceptIncomingFriendRequest

func (fr *FriendService) AcceptIncomingFriendRequest(ctx context.Context, playerID string, friendID string) error

func (*FriendService) AddFriend

func (fr *FriendService) AddFriend(ctx context.Context, playerID string, friendID string) error

func (*FriendService) FetchFriendStatuses

func (fr *FriendService) FetchFriendStatuses(ctx context.Context, friendList []string) map[string]string

func (*FriendService) FetchFriends

func (fr *FriendService) FetchFriends(ctx context.Context, friendList []string) ([]*models.FriendDetails, error)

func (*FriendService) FetchFriendsAndInfo

func (fr *FriendService) FetchFriendsAndInfo(ctx context.Context, friendList []string) ([]*models.FriendDetails, error)

func (*FriendService) RejectIncomingFriendRequest

func (fr *FriendService) RejectIncomingFriendRequest(ctx context.Context, playerID string, friendID string) error

func (*FriendService) RemoveFriend

func (fr *FriendService) RemoveFriend(ctx context.Context, playerID string, friendID string) error

type PartyInterface

type PartyInterface interface {
	CreateParty(ctx context.Context, playerID string) (partyCode string, err error)
	JoinParty(ctx context.Context, playerID, partyCode string) (err error)
	LeaveParty(ctx context.Context, playerID, partyCode string) (int64, error)

	FetchPartyKey(ctx context.Context, partyCode string) (string, error)
	FetchPartyPlayers(ctx context.Context, partyKey string) (partyPlayers []string, err error)
}

func ReturnPartyService

func ReturnPartyService() (PartyInterface, error)

type PartyService

type PartyService struct {
	//DBs
	RedisDAO redis.RedisCacheClient

	//PartyID generator function
	PartyGenerator *shortid.Shortid
}

func (*PartyService) CreateParty

func (party *PartyService) CreateParty(ctx context.Context, playerID string) (partyCode string, err error)

func (*PartyService) FetchPartyKey

func (party *PartyService) FetchPartyKey(ctx context.Context, partyCode string) (string, error)

func (*PartyService) FetchPartyPlayers

func (party *PartyService) FetchPartyPlayers(ctx context.Context, partyCode string) (partyPlayers []string, err error)

func (*PartyService) JoinParty

func (party *PartyService) JoinParty(ctx context.Context, playerID, partyCode string) (err error)

func (*PartyService) LeaveParty

func (party *PartyService) LeaveParty(ctx context.Context, playerID, partyCode string) (int64, error)

type PlayerInterface

type PlayerInterface interface {
	ValidateNewPlayerRequest(ctx context.Context, req *ssp.NewPlayer) []error
	CreateNewPlayer(ctx context.Context, req *ssp.NewPlayer) (string, error)
	FetchPlayerInfo(ctx context.Context, playerID string, username string) (*models.Player, error)
	UpdatePlayerStatusREDIS(ctx context.Context, playerID string, status string, timeout int) error
}

func ReturnPlayerService

func ReturnPlayerService() (PlayerInterface, error)

type PlayerService

type PlayerService struct {
	//DBs
	MongoDAO mongodb.MongoDBClient
	RedisDAO redis.RedisCacheClient
}

func (*PlayerService) CreateNewPlayer

func (pl *PlayerService) CreateNewPlayer(ctx context.Context, req *ssp.NewPlayer) (string, error)

func (*PlayerService) FetchPlayerInfo

func (pl *PlayerService) FetchPlayerInfo(ctx context.Context, playerID string, username string) (*models.Player, error)

func (*PlayerService) PlayerValuesUnique

func (pl *PlayerService) PlayerValuesUnique(ctx context.Context, username, email string) (usernameUnique, emailUnique bool)

func (*PlayerService) UpdatePlayerStatusREDIS

func (pl *PlayerService) UpdatePlayerStatusREDIS(ctx context.Context, playerID string, status string, timeout int) error

func (*PlayerService) ValidateNewPlayerRequest

func (pl *PlayerService) ValidateNewPlayerRequest(ctx context.Context, req *ssp.NewPlayer) []error

Jump to

Keyboard shortcuts

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