tg_account

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: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntityType                 = "TgAccount"
	PropertySysname_UserID     = "TgAccount.UserID"
	PropertySysname_AccessHash = "TgAccount.AccessHash"
	PropertySysname_FirstName  = "TgAccount.FirstName"
	PropertySysname_LastName   = "TgAccount.LastName"
	PropertySysname_UserName   = "TgAccount.UserName"
	PropertySysname_Phone      = "TgAccount.Phone"
	PropertySysname_Photo      = "TgAccount.Photo"
	PropertySysname_LangCode   = "TgAccount.LangCode"
	PropertySysname_CreatedAt  = "TgAccount.CreatedAt"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IService

type IService interface {
	New(ctx context.Context) (*TgAccount, error)
	Get(ctx context.Context, id uint, langID uint) (*TgAccount, error)
	Query(ctx context.Context, condition *selection_condition.SelectionCondition, langID uint) ([]TgAccount, error)
	First(ctx context.Context, condition *selection_condition.SelectionCondition, langID uint) (*TgAccount, error)
	Count(ctx context.Context, condition *selection_condition.SelectionCondition, langID uint) (uint, error)
	Create(ctx context.Context, obj *TgAccount, langID uint) error
	Update(ctx context.Context, obj *TgAccount, langID uint) error
	Delete(ctx context.Context, id uint) error
}

IService encapsulates usecase logic for TgAccount.

func NewService

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

NewService creates a new service.

type Repository

type Repository interface {
	New(ctx context.Context) (*TgAccount, error)
	// Get returns the entity with the specified ID.
	Get(ctx context.Context, id uint, langID uint) (*TgAccount, error)
	// Query returns the list of albums with the given offset and limit.
	Query(ctx context.Context, condition *selection_condition.SelectionCondition, langID uint) ([]TgAccount, error)
	First(ctx context.Context, condition *selection_condition.SelectionCondition, langID uint) (*TgAccount, 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 *TgAccount, langID uint) error
	// Update updates the album with given ID in the storage.
	Update(ctx context.Context, obj *TgAccount, langID uint) error
	// Delete removes the album with given ID from the storage.
	Delete(ctx context.Context, id uint) error
}

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

type TgAccount

type TgAccount struct {
	*entity.Entity
	ID         uint
	UserID     int // в gotd/td это поле int64, но ярус поддерживает только int
	AccessHash int // в gotd/td это поле int64, но ярус поддерживает только int
	FirstName  string
	LastName   string
	UserName   string
	Phone      string
	Photo      string
	LangCode   string
	CreatedAt  time.Time
}

TgAccount is the TgAccount entity

func (TgAccount) EntityType

func (e TgAccount) EntityType() string

func (*TgAccount) GetMapNameSysname

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

func (*TgAccount) GetValidPropertySysnames

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

func (*TgAccount) SetAccessHash

func (e *TgAccount) SetAccessHash(ctx context.Context, value int) error

func (*TgAccount) SetCreatedAt

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

func (*TgAccount) SetFirstName

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

func (*TgAccount) SetLangCode

func (e *TgAccount) SetLangCode(ctx context.Context, value string) error

func (*TgAccount) SetLastName

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

func (*TgAccount) SetPhone

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

func (*TgAccount) SetPhoto

func (e *TgAccount) SetPhoto(ctx context.Context, value string) error

func (*TgAccount) SetUserID

func (e *TgAccount) SetUserID(ctx context.Context, value int) error

func (*TgAccount) SetUserName

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

func (TgAccount) Validate

func (e TgAccount) Validate() error

Jump to

Keyboard shortcuts

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