domain

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2025 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppleLoginTypeApp = iota
	AppleLoginTypeWeb
)

Variables

Functions

This section is empty.

Types

type Account

type Account struct {
	Id           int64
	Zone         uint8
	IdStr        string
	Apple        string
	Google       string
	Facebook     string
	Username     string
	PasswordHash string
	Salt         string
	RegisterIp   string
	LastLoginIp  string
	DefaultColor string
	Channel      int32
	State        int32
	Device       string
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

func (*Account) LogInfo

func (acc *Account) LogInfo() string

type AccountDomain

type AccountDomain struct {
	// contains filtered or unexported fields
}

func NewAccountDomain

func NewAccountDomain(logger log.Logger, repo AccountRepo) (do *AccountDomain)

func (*AccountDomain) Create

func (do *AccountDomain) Create(ctx context.Context, acc *Account) (*Account, error)

func (*AccountDomain) GetById

func (do *AccountDomain) GetById(ctx context.Context, id int64) (*Account, error)

type AccountRepo

type AccountRepo interface {
	Create(ctx context.Context, account *Account) (*Account, error)
	GetById(ctx context.Context, id int64) (*Account, error)
	GetByApple(ctx context.Context, apple string) (*Account, error)
	GetByGoogle(ctx context.Context, google string) (*Account, error)
	GetByFacebook(ctx context.Context, facebook string) (*Account, error)
	GetByUsername(ctx context.Context, name string) (*Account, error)
	UpdatePasswordHash(ctx context.Context, id int64, passwordHash string) (bool, error)
}

type AppleDomain

type AppleDomain struct {
	// contains filtered or unexported fields
}

func NewAppleDomain

func NewAppleDomain(logger log.Logger, label *conf.Label, c *conf.Platform, repo AccountRepo) (do *AppleDomain, err error)

func (*AppleDomain) CheckAppleId

func (do *AppleDomain) CheckAppleId(ctx context.Context, secret string) (*v1.AppleId, error)

func (*AppleDomain) CreateAccount

func (do *AppleDomain) CreateAccount(ctx context.Context, appleId string, ip string) (*Account, error)

func (*AppleDomain) GetAccount

func (do *AppleDomain) GetAccount(ctx context.Context, appleId string) (*Account, error)

func (*AppleDomain) GetOrCreateAccount

func (do *AppleDomain) GetOrCreateAccount(ctx context.Context, appleId string, ip string) (acc *Account, isCreated bool, err error)

func (*AppleDomain) RequestPlatformIdByAppToken

func (do *AppleDomain) RequestPlatformIdByAppToken(ctx context.Context, token string) (appleId string, err error)

func (*AppleDomain) RequestPlatformIdByWebToken

func (do *AppleDomain) RequestPlatformIdByWebToken(ctx context.Context, token string) (appleId string, err error)

func (*AppleDomain) RequestToken

func (do *AppleDomain) RequestToken(ctx context.Context, code string) (string, error)

type ChannelType

type ChannelType int32
const (
	ChannelTypeDefault ChannelType = iota
	ChannelTypeApple
	ChannelTypeGoogle
	ChannelTypeFacebook
)

type FacebookDomain

type FacebookDomain struct {
	// contains filtered or unexported fields
}

func NewFacebookDomain

func NewFacebookDomain(logger log.Logger, label *conf.Label, c *conf.Platform, repo AccountRepo) (do *FacebookDomain, err error)

func (*FacebookDomain) GetAccount

func (do *FacebookDomain) GetAccount(ctx context.Context, facebookId string) (*Account, error)

func (*FacebookDomain) GetOrCreateAccount

func (do *FacebookDomain) GetOrCreateAccount(ctx context.Context, facebookId string, ip string) (acc *Account, isCreated bool, err error)

func (*FacebookDomain) RequestPlatformId

func (do *FacebookDomain) RequestPlatformId(ctx context.Context, token string) (string, error)

type GoogleDomain

type GoogleDomain struct {
	// contains filtered or unexported fields
}

func NewGoogleDomain

func NewGoogleDomain(logger log.Logger, label *conf.Label, c *conf.Platform, repo AccountRepo) (do *GoogleDomain, err error)

func (*GoogleDomain) GetAccount

func (do *GoogleDomain) GetAccount(ctx context.Context, googleId string) (*Account, error)

func (*GoogleDomain) GetOrCreateAccount

func (do *GoogleDomain) GetOrCreateAccount(ctx context.Context, googleId string, ip string) (acc *Account, isRegister bool, err error)

func (*GoogleDomain) RequestPlatformId

func (do *GoogleDomain) RequestPlatformId(ctx context.Context, token string) (string, error)

type UsernameDomain

type UsernameDomain struct {
	// contains filtered or unexported fields
}

func NewUsernameDomain

func NewUsernameDomain(logger log.Logger, repo AccountRepo) (do *UsernameDomain)

func (*UsernameDomain) GetAccountByUsername

func (do *UsernameDomain) GetAccountByUsername(ctx context.Context, name string) (*Account, error)

func (*UsernameDomain) UpdatePasswordHash

func (do *UsernameDomain) UpdatePasswordHash(ctx context.Context, id int64, password string) (bool, error)

Jump to

Keyboard shortcuts

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