user

package
v0.0.0-...-4f702ff Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntityType               = "User"
	PropertySysnameEmail     = "User.Email"
	PropertySysnamePhone     = "User.Phone"
	PropertySysnameFirstName = "User.FirstName"
	PropertySysnameLastName  = "User.LastName"
	PropertySysnameUserName  = "User.UserName"
	PropertySysnameCreatedAt = "User.CreatedAt"
	RelationSysnameTgAccount = "User.TgAccount"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IService

type IService interface {
	New(ctx context.Context) (*User, error)
	Get(ctx context.Context, id uint, langID uint) (*User, error)
	//GetByAccountID(ctx context.Context, accountId string, langID uint) (*User, error)
	Query(ctx context.Context, condition *selection_condition.SelectionCondition, langID uint) ([]User, error)
	First(ctx context.Context, condition *selection_condition.SelectionCondition, langID uint) (*User, error)
	Count(ctx context.Context, condition *selection_condition.SelectionCondition, langID uint) (uint, error)
	Create(ctx context.Context, obj *User, langID uint) error
	Update(ctx context.Context, obj *User, langID uint) error
	Delete(ctx context.Context, id uint) error
	AccountSettingsValidate(ctx context.Context, accountSettings *account.AccountSettings) error
	GetTgAccount(ctx context.Context, obj *User, langID uint) (*tg_account.TgAccount, error)
	GetByTgAccount(ctx context.Context, obj *tg_account.TgAccount, langID uint) (*User, error)
}

IService encapsulates usecase logic for user.

func NewService

func NewService(logger log.Logger, repo Repository) IService

NewService creates a new service.

type Repository

type Repository interface {
	New(ctx context.Context) (*User, error)
	// Get returns the entity with the specified ID.
	Get(ctx context.Context, id uint, langID uint) (*User, error)
	// Query returns the list of albums with the given offset and limit.
	Query(ctx context.Context, condition *selection_condition.SelectionCondition, langID uint) ([]User, error)
	First(ctx context.Context, condition *selection_condition.SelectionCondition, langID uint) (*User, error)
	// Count returns the number of items.
	Count(ctx context.Context, condition *selection_condition.SelectionCondition, langID uint) (uint, error)
	SetDefaultConditions(conditions *selection_condition.SelectionCondition)
	// Create saves a new album in the storage.
	Create(ctx context.Context, obj *User, langID uint) error
	// Update updates the album with given ID in the storage.
	Update(ctx context.Context, obj *User, langID uint) error
	// Delete removes the album with given ID from the storage.
	Delete(ctx context.Context, id uint) error
	LangIDValidate(ctx context.Context, langID uint) error
	GetTgAccount(ctx context.Context, obj *User, langID uint) (*tg_account.TgAccount, error)
	GetByTgAccount(ctx context.Context, obj *tg_account.TgAccount, langID uint) (*User, error)
}

Repository encapsulates the logic to access albums from the data source.

type User

type User struct {
	*entity.Entity
	ID        uint
	Email     string
	Phone     string
	FirstName string
	LastName  string
	UserName  string
	CreatedAt time.Time
}

User is the user entity

func (*User) EntityType

func (e *User) EntityType() string

func (*User) GetMapNameSysname

func (e *User) GetMapNameSysname() map[string]string

func (*User) GetValidPropertySysnames

func (e *User) GetValidPropertySysnames() []string

func (*User) SetCreatedAt

func (e *User) SetCreatedAt(ctx context.Context, value time.Time) error

func (*User) SetEmail

func (e *User) SetEmail(ctx context.Context, value string) error

func (*User) SetFirstName

func (e *User) SetFirstName(ctx context.Context, value string) error

func (*User) SetLastName

func (e *User) SetLastName(ctx context.Context, value string) error

func (*User) SetPhone

func (e *User) SetPhone(ctx context.Context, value string) error

func (*User) SetUserName

func (e *User) SetUserName(ctx context.Context, value string) error

func (*User) Validate

func (e *User) Validate() error

Jump to

Keyboard shortcuts

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