Documentation
¶
Index ¶
- Variables
- type Options
- type Service
- func (s *Service) AddCharacter(ctx context.Context, playerID int64, data pangya.PlayerCharacterData) error
- func (s *Service) AddSession(ctx context.Context, playerID int64, address string) (dbmodels.Session, error)
- func (s *Service) Authenticate(ctx context.Context, username, password string) (dbmodels.Player, error)
- func (s *Service) DeleteExpiredSessions(ctx context.Context) error
- func (s *Service) GetCharacters(ctx context.Context, playerID int64) ([]pangya.PlayerCharacterData, error)
- func (s *Service) GetPlayer(ctx context.Context, playerID int64) (dbmodels.Player, error)
- func (s *Service) GetSession(ctx context.Context, sessionID int64) (dbmodels.Session, error)
- func (s *Service) GetSessionByKey(ctx context.Context, sessionKey string) (dbmodels.Session, error)
- func (s *Service) HasCharacters(ctx context.Context, playerID int64) (bool, error)
- func (s *Service) Register(ctx context.Context, username, password string) (dbmodels.Player, error)
- func (s *Service) SetNickname(ctx context.Context, playerID int64, nickname string) (dbmodels.Player, error)
- func (s *Service) UpdateSessionExpiry(ctx context.Context, sessionID int64) (dbmodels.Session, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidPassword = errors.New("invalid password") ErrUnknownUsername = errors.New("unknown user") )
Enumeration of possible errors that can be returned from authenticate.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements account services using the database.
func NewService ¶
NewService creates new account services using the database.
func (*Service) AddCharacter ¶
func (s *Service) AddCharacter(ctx context.Context, playerID int64, data pangya.PlayerCharacterData) error
AddCharacter adds a character for a given player.
func (*Service) AddSession ¶
func (s *Service) AddSession(ctx context.Context, playerID int64, address string) (dbmodels.Session, error)
AddSession adds a new session for a player.
func (*Service) Authenticate ¶
func (s *Service) Authenticate(ctx context.Context, username, password string) (dbmodels.Player, error)
Authenticate authenticates a user using the database.
func (*Service) DeleteExpiredSessions ¶
DeleteExpiredSessions deletes sessions that have expired.
func (*Service) GetCharacters ¶
func (s *Service) GetCharacters(ctx context.Context, playerID int64) ([]pangya.PlayerCharacterData, error)
GetCharacters returns the characters for a given player.
func (*Service) GetSession ¶
GetSession gets a session by its ID.
func (*Service) GetSessionByKey ¶
GetSessionByKey gets a session by its session key.
func (*Service) HasCharacters ¶
HasCharacters returns whether or not the player has characters.
Click to show internal directories.
Click to hide internal directories.