Documentation
¶
Index ¶
- Constants
- Variables
- type Account
- type AuthResult
- type AuthService
- func (s *AuthService) Login(ctx context.Context, email string, password string) (*AuthResult, error)
- func (s *AuthService) Logout(_ context.Context, token string) error
- func (s *AuthService) Register(ctx context.Context, email string, password string, nickname string, ...) (*AuthResult, error)
- func (s *AuthService) ResetPassword(ctx context.Context, email string, code string, newPassword string) (*AuthResult, error)
- func (s *AuthService) SendEmailCode(ctx context.Context, email string, scene string) error
- type AuthToken
- type PlayerData
- type PlayerDataService
- func (s *PlayerDataService) Delete(ctx context.Context, accountID uint64, id uint64) error
- func (s *PlayerDataService) Get(ctx context.Context, accountID uint64, id uint64) (*PlayerData, error)
- func (s *PlayerDataService) List(ctx context.Context, accountID uint64, gameKey string) ([]PlayerDataSummary, error)
- func (s *PlayerDataService) Update(ctx context.Context, accountID uint64, id uint64, data json.RawMessage) (*PlayerData, error)
- func (s *PlayerDataService) Upsert(ctx context.Context, accountID uint64, gameKey string, slotKey string, ...) (*PlayerData, error)
- type PlayerDataSummary
Constants ¶
View Source
const ( CodeSceneRegister = "register" CodeSceneResetPassword = "reset_password" )
Variables ¶
View Source
var ( ErrInvalidInput = errors.New("invalid input") ErrEmailExists = errors.New("email already exists") ErrAccountNotFound = errors.New("account not found") ErrAccountDisabled = errors.New("account disabled") ErrInvalidCredentials = errors.New("invalid email or password") ErrTooManyRequests = errors.New("too many requests") ErrInvalidCode = errors.New("invalid verification code") ErrCodeExpired = errors.New("verification code expired") ErrCodeTooManyAttempts = errors.New("too many verification attempts") ErrSaveNotFound = errors.New("player data not found") )
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
ID uint64 `json:"id"`
Email string `json:"email"`
Nickname string `json:"nickname"`
Status int `json:"status"`
LoginCount uint64 `json:"login_count"`
LastLoginAt *time.Time `json:"last_login_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func AuthenticateToken ¶
type AuthResult ¶
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
func NewAuthService ¶
func NewAuthService(sender mailer.Sender) *AuthService
func (*AuthService) Login ¶
func (s *AuthService) Login(ctx context.Context, email string, password string) (*AuthResult, error)
func (*AuthService) Register ¶
func (s *AuthService) Register(ctx context.Context, email string, password string, nickname string, code string) (*AuthResult, error)
func (*AuthService) ResetPassword ¶
func (s *AuthService) ResetPassword(ctx context.Context, email string, code string, newPassword string) (*AuthResult, error)
func (*AuthService) SendEmailCode ¶
type PlayerData ¶
type PlayerDataService ¶
type PlayerDataService struct{}
func NewPlayerDataService ¶
func NewPlayerDataService() *PlayerDataService
func (*PlayerDataService) Get ¶
func (s *PlayerDataService) Get(ctx context.Context, accountID uint64, id uint64) (*PlayerData, error)
func (*PlayerDataService) List ¶
func (s *PlayerDataService) List(ctx context.Context, accountID uint64, gameKey string) ([]PlayerDataSummary, error)
func (*PlayerDataService) Update ¶
func (s *PlayerDataService) Update(ctx context.Context, accountID uint64, id uint64, data json.RawMessage) (*PlayerData, error)
func (*PlayerDataService) Upsert ¶
func (s *PlayerDataService) Upsert(ctx context.Context, accountID uint64, gameKey string, slotKey string, data json.RawMessage) (*PlayerData, error)
Click to show internal directories.
Click to hide internal directories.