Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAccountConflictOnSave = errors.New("conflic when saving an account: the account version is different from the persisted account")
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
Account is a user account
func CreateAccountFromRepository ¶
func CreateAccountFromRepository(id string, telegramID TelegramID, version uint) *Account
CreateAccountFromRepository map a repository model Account to a domain model Account.
func NewAccount ¶
func NewAccount(id string, telegramID TelegramID) (*Account, error)
NewAccount instantiate a new user account in the application.
func (Account) TelegramID ¶
func (a Account) TelegramID() TelegramID
TelegramID is the telegram account ID related to the current account.
type AccountRepository ¶
type AccountRepository interface {
// Save create or update an account in the repository. Verify optimistic locking.
Save(ctx context.Context, account *Account) error
// GetOneByTgID returns an account by a TelegramID.
GetOneByTgID(ctx context.Context, tgID TelegramID) (*Account, error)
// GetOneByID returns an account by an ID.
GetOneByID(ctx context.Context, id string) (*Account, error)
}
AccountRepository is an implementation of the repository pattern for the Account entity.
type TelegramID ¶
type TelegramID struct {
// contains filtered or unexported fields
}
TelegramID represent a Telegram account ID.
func NewTelegramID ¶
func NewTelegramID(val int64) (TelegramID, error)
func (TelegramID) String ¶
func (t TelegramID) String() string
String returns the account value as string.
func (TelegramID) Value ¶
func (t TelegramID) Value() int64
Value returns the account value as int64.
Click to show internal directories.
Click to hide internal directories.